Skip to content

Commit d4caaeb

Browse files
committed
Merge branch '6.0.x'
# Conflicts: # spring-context/src/main/java/org/springframework/validation/Errors.java # spring-context/src/test/java/org/springframework/validation/DataBinderTests.java
2 parents 10cb232 + 8cc6dd6 commit d4caaeb

File tree

7 files changed

+27
-32
lines changed

7 files changed

+27
-32
lines changed

spring-context/src/main/java/org/springframework/validation/AbstractBindingResult.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ public void reject(String errorCode, @Nullable Object[] errorArgs, @Nullable Str
102102
}
103103

104104
@Override
105-
public void rejectValue(@Nullable String field, String errorCode, @Nullable Object[] errorArgs,
106-
@Nullable String defaultMessage) {
105+
public void rejectValue(@Nullable String field, String errorCode,
106+
@Nullable Object[] errorArgs, @Nullable String defaultMessage) {
107107

108108
if (!StringUtils.hasLength(getNestedPath()) && !StringUtils.hasLength(field)) {
109109
// We're at the top of the nested object hierarchy,

spring-context/src/main/java/org/springframework/validation/BeanPropertyBindingResult.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2023 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.
@@ -55,7 +55,7 @@ public class BeanPropertyBindingResult extends AbstractPropertyBindingResult imp
5555

5656

5757
/**
58-
* Creates a new instance of the {@link BeanPropertyBindingResult} class.
58+
* Create a new {@code BeanPropertyBindingResult} for the given target.
5959
* @param target the target bean to bind onto
6060
* @param objectName the name of the target object
6161
*/
@@ -64,7 +64,7 @@ public BeanPropertyBindingResult(@Nullable Object target, String objectName) {
6464
}
6565

6666
/**
67-
* Creates a new instance of the {@link BeanPropertyBindingResult} class.
67+
* Create a new {@code BeanPropertyBindingResult} for the given target.
6868
* @param target the target bean to bind onto
6969
* @param objectName the name of the target object
7070
* @param autoGrowNestedPaths whether to "auto-grow" a nested path that contains a null value

spring-context/src/main/java/org/springframework/validation/BindException.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2023 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.
@@ -128,7 +128,9 @@ public void rejectValue(@Nullable String field, String errorCode, String default
128128
}
129129

130130
@Override
131-
public void rejectValue(@Nullable String field, String errorCode, @Nullable Object[] errorArgs, @Nullable String defaultMessage) {
131+
public void rejectValue(@Nullable String field, String errorCode,
132+
@Nullable Object[] errorArgs, @Nullable String defaultMessage) {
133+
132134
this.bindingResult.rejectValue(field, errorCode, errorArgs, defaultMessage);
133135
}
134136

spring-context/src/main/java/org/springframework/validation/DirectFieldBindingResult.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2023 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.
@@ -46,7 +46,7 @@ public class DirectFieldBindingResult extends AbstractPropertyBindingResult {
4646

4747

4848
/**
49-
* Create a new DirectFieldBindingResult instance.
49+
* Create a new {@code DirectFieldBindingResult} for the given target.
5050
* @param target the target object to bind onto
5151
* @param objectName the name of the target object
5252
*/
@@ -55,7 +55,7 @@ public DirectFieldBindingResult(@Nullable Object target, String objectName) {
5555
}
5656

5757
/**
58-
* Create a new DirectFieldBindingResult instance.
58+
* Create a new {@code DirectFieldBindingResult} for the given target.
5959
* @param target the target object to bind onto
6060
* @param objectName the name of the target object
6161
* @param autoGrowNestedPaths whether to "auto-grow" a nested path that contains a null value

spring-context/src/main/java/org/springframework/validation/Errors.java

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
*
4040
* @author Rod Johnson
4141
* @author Juergen Hoeller
42-
* @see #setNestedPath
4342
* @see Validator
4443
* @see ValidationUtils
4544
* @see SimpleErrors
@@ -231,7 +230,7 @@ default <T extends Throwable> void failOnError(Function<String, T> messageToExce
231230
}
232231

233232
/**
234-
* BReturn if there were any errors.
233+
* Determine if there were any errors.
235234
* @see #hasGlobalErrors()
236235
* @see #hasFieldErrors()
237236
*/
@@ -240,7 +239,7 @@ default boolean hasErrors() {
240239
}
241240

242241
/**
243-
* Return the total number of errors.
242+
* Determine the total number of errors.
244243
* @see #getGlobalErrorCount()
245244
* @see #getFieldErrorCount()
246245
*/
@@ -250,7 +249,7 @@ default int getErrorCount() {
250249

251250
/**
252251
* Get all errors, both global and field ones.
253-
* @return a list of {@link ObjectError} instances
252+
* @return a list of {@link ObjectError}/{@link FieldError} instances
254253
* @see #getGlobalErrors()
255254
* @see #getFieldErrors()
256255
*/
@@ -259,17 +258,15 @@ default List<ObjectError> getAllErrors() {
259258
}
260259

261260
/**
262-
* Are there any global errors?
263-
* @return {@code true} if there are any global errors
261+
* Determine if there were any global errors.
264262
* @see #hasFieldErrors()
265263
*/
266264
default boolean hasGlobalErrors() {
267265
return !getGlobalErrors().isEmpty();
268266
}
269267

270268
/**
271-
* Return the number of global errors.
272-
* @return the number of global errors
269+
* Determine the number of global errors.
273270
* @see #getFieldErrorCount()
274271
*/
275272
default int getGlobalErrorCount() {
@@ -294,17 +291,15 @@ default ObjectError getGlobalError() {
294291
}
295292

296293
/**
297-
* Are there any field errors?
298-
* @return {@code true} if there are any errors associated with a field
294+
* Determine if there were any errors associated with a field.
299295
* @see #hasGlobalErrors()
300296
*/
301297
default boolean hasFieldErrors() {
302298
return !getFieldErrors().isEmpty();
303299
}
304300

305301
/**
306-
* Return the number of errors associated with a field.
307-
* @return the number of errors associated with a field
302+
* Determine the number of errors associated with a field.
308303
* @see #getGlobalErrorCount()
309304
*/
310305
default int getFieldErrorCount() {
@@ -329,19 +324,17 @@ default FieldError getFieldError() {
329324
}
330325

331326
/**
332-
* Are there any errors associated with the given field?
327+
* Determine if there were any errors associated with the given field.
333328
* @param field the field name
334-
* @return {@code true} if there were any errors associated with the given field
335329
* @see #hasFieldErrors()
336330
*/
337331
default boolean hasFieldErrors(String field) {
338332
return (getFieldError(field) != null);
339333
}
340334

341335
/**
342-
* Return the number of errors associated with the given field.
336+
* Determine the number of errors associated with the given field.
343337
* @param field the field name
344-
* @return the number of errors associated with the given field
345338
* @see #getFieldErrorCount()
346339
*/
347340
default int getFieldErrorCount(String field) {
@@ -384,7 +377,7 @@ default FieldError getFieldError(String field) {
384377
Object getFieldValue(String field);
385378

386379
/**
387-
* Return the type of a given field.
380+
* Determine the type of the given field, as far as possible.
388381
* <p>Implementations should be able to determine the type even
389382
* when the field value is {@code null}, for example from some
390383
* associated descriptor.

spring-web/src/main/java/org/springframework/web/bind/EscapedErrors.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2023 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.
@@ -110,8 +110,8 @@ public void rejectValue(@Nullable String field, String errorCode, String default
110110
}
111111

112112
@Override
113-
public void rejectValue(@Nullable String field, String errorCode, @Nullable Object[] errorArgs,
114-
@Nullable String defaultMessage) {
113+
public void rejectValue(@Nullable String field, String errorCode,
114+
@Nullable Object[] errorArgs, @Nullable String defaultMessage) {
115115

116116
this.source.rejectValue(field, errorCode, errorArgs, defaultMessage);
117117
}

spring-web/src/main/java/org/springframework/web/bind/support/WebExchangeBindException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ public void rejectValue(@Nullable String field, String errorCode, String default
145145
}
146146

147147
@Override
148-
public void rejectValue(
149-
@Nullable String field, String errorCode, @Nullable Object[] errorArgs, @Nullable String defaultMessage) {
148+
public void rejectValue(@Nullable String field, String errorCode,
149+
@Nullable Object[] errorArgs, @Nullable String defaultMessage) {
150150

151151
this.bindingResult.rejectValue(field, errorCode, errorArgs, defaultMessage);
152152
}

0 commit comments

Comments
 (0)