diff --git a/spring-web/src/main/java/org/springframework/web/ErrorResponse.java b/spring-web/src/main/java/org/springframework/web/ErrorResponse.java index 5d7066ccc08..a92416f4dcc 100644 --- a/spring-web/src/main/java/org/springframework/web/ErrorResponse.java +++ b/spring-web/src/main/java/org/springframework/web/ErrorResponse.java @@ -65,19 +65,19 @@ public interface ErrorResponse { /** * Return a code to use to resolve the problem "detail" for this exception - * through a {@link org.springframework.context.MessageSource}. + * through a {@link MessageSource}. *

By default this is initialized via - * {@link #getDefaultDetailMessageCode(Class, String)} but each exception - * overrides this to provide relevant data that that can be expanded into - * placeholders within the message. + * {@link #getDefaultDetailMessageCode(Class, String)}. */ default String getDetailMessageCode() { return getDefaultDetailMessageCode(getClass(), null); } /** - * Return the arguments to use to resolve the problem "detail" through a - * {@link MessageSource}. + * Return arguments to use along with a {@link #getDetailMessageCode() + * message code} to resolve the problem "detail" for this exception + * through a {@link MessageSource}. The arguments are expanded + * into placeholders of the message value, e.g. "Invalid content type {0}". */ @Nullable default Object[] getDetailMessageArguments() { @@ -86,10 +86,8 @@ public interface ErrorResponse { /** * Variant of {@link #getDetailMessageArguments()} that uses the given - * {@link MessageSource} to resolve the message arguments. - *

By default this delegates to {@link #getDetailMessageArguments()} - * by concrete implementations may override it, for example in order to - * resolve validation errors through a {@code MessageSource}. + * {@link MessageSource} for resolving the message argument values. + * This is useful for example to message codes from validation errors. */ @Nullable default Object[] getDetailMessageArguments(MessageSource messageSource, Locale locale) { diff --git a/spring-web/src/main/java/org/springframework/web/HttpRequestMethodNotSupportedException.java b/spring-web/src/main/java/org/springframework/web/HttpRequestMethodNotSupportedException.java index 26a75f8dfe0..7fa420b6750 100644 --- a/spring-web/src/main/java/org/springframework/web/HttpRequestMethodNotSupportedException.java +++ b/spring-web/src/main/java/org/springframework/web/HttpRequestMethodNotSupportedException.java @@ -52,9 +52,7 @@ public class HttpRequestMethodNotSupportedException extends ServletException imp /** * Create a new HttpRequestMethodNotSupportedException. * @param method the unsupported HTTP request method - * @deprecated 6.0 in favor of {@link #HttpRequestMethodNotSupportedException(String, Collection)} */ - @Deprecated(since = "6.0", forRemoval = true) public HttpRequestMethodNotSupportedException(String method) { this(method, (String[]) null); } diff --git a/spring-web/src/main/java/org/springframework/web/bind/MethodArgumentNotValidException.java b/spring-web/src/main/java/org/springframework/web/bind/MethodArgumentNotValidException.java index 9f5214df681..66c27ac32a9 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/MethodArgumentNotValidException.java +++ b/spring-web/src/main/java/org/springframework/web/bind/MethodArgumentNotValidException.java @@ -111,8 +111,8 @@ public class MethodArgumentNotValidException extends BindException implements Er } /** - * Convert each given {@link ObjectError} to a single quote String, taking - * either an error's default message as a first choice, or its error code. + * Convert each given {@link ObjectError} to a String in single quotes, taking + * either the error's default message, or its error code. * @since 6.0 */ public static List errorsToStringList(List errors) { @@ -121,9 +121,9 @@ public class MethodArgumentNotValidException extends BindException implements Er } /** - * Variant of {@link #errorsToStringList(List)} that uses the provided - * {@link MessageSource} to resolve the error code, or otherwise fall - * back on its default message. + * Variant of {@link #errorsToStringList(List)} that uses a + * {@link MessageSource} to resolve the message code of the error, or fall + * back on the error's default message. * @since 6.0 */ @SuppressWarnings("ConstantConditions") diff --git a/spring-web/src/main/java/org/springframework/web/bind/MissingRequestValueException.java b/spring-web/src/main/java/org/springframework/web/bind/MissingRequestValueException.java index 16b14655f84..8770b3d6449 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/MissingRequestValueException.java +++ b/spring-web/src/main/java/org/springframework/web/bind/MissingRequestValueException.java @@ -41,8 +41,8 @@ public class MissingRequestValueException extends ServletRequestBindingException } /** - * Constructor with a message and a flag that indicates whether the value - * was not completely missing but became was {@code null} after conversion. + * Constructor with a message and a flag that indicates whether a value + * was present but became {@code null} after conversion. */ public MissingRequestValueException(String msg, boolean missingAfterConversion) { super(msg); diff --git a/spring-web/src/main/java/org/springframework/web/bind/UnsatisfiedServletRequestParameterException.java b/spring-web/src/main/java/org/springframework/web/bind/UnsatisfiedServletRequestParameterException.java index a65ef06ca28..be6a2d43fba 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/UnsatisfiedServletRequestParameterException.java +++ b/spring-web/src/main/java/org/springframework/web/bind/UnsatisfiedServletRequestParameterException.java @@ -69,7 +69,7 @@ public class UnsatisfiedServletRequestParameterException extends ServletRequestB private static List paramsToStringList(List paramConditions) { Assert.notEmpty(paramConditions, "Parameter conditions must not be empty"); return paramConditions.stream() - .map(c -> "\"" + StringUtils.arrayToDelimitedString(c, ", ") + "\"") + .map(condition -> "\"" + StringUtils.arrayToDelimitedString(condition, ", ") + "\"") .collect(Collectors.toList()); } diff --git a/spring-web/src/main/java/org/springframework/web/server/ResponseStatusException.java b/spring-web/src/main/java/org/springframework/web/server/ResponseStatusException.java index 218d7579fad..d72992d22ce 100644 --- a/spring-web/src/main/java/org/springframework/web/server/ResponseStatusException.java +++ b/spring-web/src/main/java/org/springframework/web/server/ResponseStatusException.java @@ -80,8 +80,8 @@ public class ResponseStatusException extends ErrorResponseException { } /** - * Constructor with a {@link org.springframework.context.MessageSource} - * code and arguments to resolve the detail message with. + * Constructor with a message code and arguments for resolving the error + * "detail" via {@link org.springframework.context.MessageSource}. * @param status the HTTP status (required) * @param reason the associated reason (optional) * @param cause a nested exception (optional) diff --git a/spring-web/src/main/java/org/springframework/web/server/ServerWebInputException.java b/spring-web/src/main/java/org/springframework/web/server/ServerWebInputException.java index 5853facaf2f..530135b0924 100644 --- a/spring-web/src/main/java/org/springframework/web/server/ServerWebInputException.java +++ b/spring-web/src/main/java/org/springframework/web/server/ServerWebInputException.java @@ -57,8 +57,8 @@ public class ServerWebInputException extends ResponseStatusException { } /** - * Constructor with a {@link org.springframework.context.MessageSource} code - * and arguments to resolve the detail message with. + * Constructor with a message code and arguments for resolving the error + * "detail" via {@link org.springframework.context.MessageSource}. * @since 6.0 */ protected ServerWebInputException(String reason, @Nullable MethodParameter parameter, @Nullable Throwable cause,