Undo constructor deprecation + polishing

This commit is contained in:
rstoyanchev 2022-10-05 20:03:34 +01:00
parent 30f1eee4d0
commit ffe2ba4c7b
7 changed files with 20 additions and 24 deletions

View File

@ -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}.
* <p>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.
* <p>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) {

View File

@ -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);
}

View File

@ -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<String> errorsToStringList(List<? extends ObjectError> 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")

View File

@ -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);

View File

@ -69,7 +69,7 @@ public class UnsatisfiedServletRequestParameterException extends ServletRequestB
private static List<String> paramsToStringList(List<String[]> 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());
}

View File

@ -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)

View File

@ -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,