Polishing

This commit is contained in:
Juergen Hoeller
2023-07-19 23:31:38 +02:00
parent a7b7466274
commit 340b32a3cb
11 changed files with 233 additions and 204 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -110,8 +110,8 @@ public class EscapedErrors implements Errors {
}
@Override
public void rejectValue(@Nullable String field, String errorCode, @Nullable Object[] errorArgs,
@Nullable String defaultMessage) {
public void rejectValue(@Nullable String field, String errorCode,
@Nullable Object[] errorArgs, @Nullable String defaultMessage) {
this.source.rejectValue(field, errorCode, errorArgs, defaultMessage);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,14 +54,13 @@ public class WebExchangeBindException extends ServerWebInputException implements
/**
* Return the BindingResult that this BindException wraps.
* Will typically be a BeanPropertyBindingResult.
* <p>Will typically be a BeanPropertyBindingResult.
* @see BeanPropertyBindingResult
*/
public final BindingResult getBindingResult() {
return this.bindingResult;
}
@Override
public String getObjectName() {
return this.bindingResult.getObjectName();
@@ -87,7 +86,6 @@ public class WebExchangeBindException extends ServerWebInputException implements
this.bindingResult.popNestedPath();
}
@Override
public void reject(String errorCode) {
this.bindingResult.reject(errorCode);
@@ -114,8 +112,8 @@ public class WebExchangeBindException extends ServerWebInputException implements
}
@Override
public void rejectValue(
@Nullable String field, String errorCode, @Nullable Object[] errorArgs, @Nullable String defaultMessage) {
public void rejectValue(@Nullable String field, String errorCode,
@Nullable Object[] errorArgs, @Nullable String defaultMessage) {
this.bindingResult.rejectValue(field, errorCode, errorArgs, defaultMessage);
}
@@ -125,7 +123,6 @@ public class WebExchangeBindException extends ServerWebInputException implements
this.bindingResult.addAllErrors(errors);
}
@Override
public boolean hasErrors() {
return this.bindingResult.hasErrors();
@@ -276,7 +273,6 @@ public class WebExchangeBindException extends ServerWebInputException implements
return this.bindingResult.getSuppressedFields();
}
/**
* Returns diagnostic information about the errors held in this object.
*/
@@ -287,8 +283,8 @@ public class WebExchangeBindException extends ServerWebInputException implements
StringBuilder sb = new StringBuilder("Validation failed for argument at index ")
.append(parameter.getParameterIndex()).append(" in method: ")
.append(parameter.getExecutable().toGenericString())
.append(", with ").append(this.bindingResult.getErrorCount()).append(" error(s): ");
for (ObjectError error : this.bindingResult.getAllErrors()) {
.append(", with ").append(getErrorCount()).append(" error(s): ");
for (ObjectError error : getAllErrors()) {
sb.append('[').append(error).append("] ");
}
return sb.toString();