Skip to content

Commit 44e9601

Browse files
committed
Merge pull request #14912 from dreis2211
* gh-14912: Use Errors.hasErrors() in DefaultErrorAttributes
2 parents d6991e6 + 3fea487 commit 44e9601

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private void handleException(Map<String, Object> errorAttributes, Throwable erro
141141
}
142142
if (error instanceof BindingResult) {
143143
BindingResult result = (BindingResult) error;
144-
if (result.getErrorCount() > 0) {
144+
if (result.hasErrors()) {
145145
errorAttributes.put("errors", result.getAllErrors());
146146
}
147147
}

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -159,7 +159,7 @@ private void addErrorMessage(Map<String, Object> errorAttributes, Throwable erro
159159
errorAttributes.put("message", error.getMessage());
160160
return;
161161
}
162-
if (result.getErrorCount() > 0) {
162+
if (result.hasErrors()) {
163163
errorAttributes.put("errors", result.getAllErrors());
164164
errorAttributes.put("message",
165165
"Validation failed for object='" + result.getObjectName()

0 commit comments

Comments
 (0)