Skip to content

Commit ffe2ba4

Browse files
committed
Undo constructor deprecation + polishing
1 parent 30f1eee commit ffe2ba4

7 files changed

+20
-24
lines changed

spring-web/src/main/java/org/springframework/web/ErrorResponse.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ default HttpHeaders getHeaders() {
6565

6666
/**
6767
* Return a code to use to resolve the problem "detail" for this exception
68-
* through a {@link org.springframework.context.MessageSource}.
68+
* through a {@link MessageSource}.
6969
* <p>By default this is initialized via
70-
* {@link #getDefaultDetailMessageCode(Class, String)} but each exception
71-
* overrides this to provide relevant data that that can be expanded into
72-
* placeholders within the message.
70+
* {@link #getDefaultDetailMessageCode(Class, String)}.
7371
*/
7472
default String getDetailMessageCode() {
7573
return getDefaultDetailMessageCode(getClass(), null);
7674
}
7775

7876
/**
79-
* Return the arguments to use to resolve the problem "detail" through a
80-
* {@link MessageSource}.
77+
* Return arguments to use along with a {@link #getDetailMessageCode()
78+
* message code} to resolve the problem "detail" for this exception
79+
* through a {@link MessageSource}. The arguments are expanded
80+
* into placeholders of the message value, e.g. "Invalid content type {0}".
8181
*/
8282
@Nullable
8383
default Object[] getDetailMessageArguments() {
@@ -86,10 +86,8 @@ default Object[] getDetailMessageArguments() {
8686

8787
/**
8888
* Variant of {@link #getDetailMessageArguments()} that uses the given
89-
* {@link MessageSource} to resolve the message arguments.
90-
* <p>By default this delegates to {@link #getDetailMessageArguments()}
91-
* by concrete implementations may override it, for example in order to
92-
* resolve validation errors through a {@code MessageSource}.
89+
* {@link MessageSource} for resolving the message argument values.
90+
* This is useful for example to message codes from validation errors.
9391
*/
9492
@Nullable
9593
default Object[] getDetailMessageArguments(MessageSource messageSource, Locale locale) {

spring-web/src/main/java/org/springframework/web/HttpRequestMethodNotSupportedException.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ public class HttpRequestMethodNotSupportedException extends ServletException imp
5252
/**
5353
* Create a new HttpRequestMethodNotSupportedException.
5454
* @param method the unsupported HTTP request method
55-
* @deprecated 6.0 in favor of {@link #HttpRequestMethodNotSupportedException(String, Collection)}
5655
*/
57-
@Deprecated(since = "6.0", forRemoval = true)
5856
public HttpRequestMethodNotSupportedException(String method) {
5957
this(method, (String[]) null);
6058
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ public Object[] getDetailMessageArguments(MessageSource messageSource, Locale lo
111111
}
112112

113113
/**
114-
* Convert each given {@link ObjectError} to a single quote String, taking
115-
* either an error's default message as a first choice, or its error code.
114+
* Convert each given {@link ObjectError} to a String in single quotes, taking
115+
* either the error's default message, or its error code.
116116
* @since 6.0
117117
*/
118118
public static List<String> errorsToStringList(List<? extends ObjectError> errors) {
@@ -121,9 +121,9 @@ public static List<String> errorsToStringList(List<? extends ObjectError> errors
121121
}
122122

123123
/**
124-
* Variant of {@link #errorsToStringList(List)} that uses the provided
125-
* {@link MessageSource} to resolve the error code, or otherwise fall
126-
* back on its default message.
124+
* Variant of {@link #errorsToStringList(List)} that uses a
125+
* {@link MessageSource} to resolve the message code of the error, or fall
126+
* back on the error's default message.
127127
* @since 6.0
128128
*/
129129
@SuppressWarnings("ConstantConditions")

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public MissingRequestValueException(String msg) {
4141
}
4242

4343
/**
44-
* Constructor with a message and a flag that indicates whether the value
45-
* was not completely missing but became was {@code null} after conversion.
44+
* Constructor with a message and a flag that indicates whether a value
45+
* was present but became {@code null} after conversion.
4646
*/
4747
public MissingRequestValueException(String msg, boolean missingAfterConversion) {
4848
super(msg);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public UnsatisfiedServletRequestParameterException(
6969
private static List<String> paramsToStringList(List<String[]> paramConditions) {
7070
Assert.notEmpty(paramConditions, "Parameter conditions must not be empty");
7171
return paramConditions.stream()
72-
.map(c -> "\"" + StringUtils.arrayToDelimitedString(c, ", ") + "\"")
72+
.map(condition -> "\"" + StringUtils.arrayToDelimitedString(condition, ", ") + "\"")
7373
.collect(Collectors.toList());
7474
}
7575

spring-web/src/main/java/org/springframework/web/server/ResponseStatusException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ public ResponseStatusException(HttpStatusCode status, @Nullable String reason, @
8080
}
8181

8282
/**
83-
* Constructor with a {@link org.springframework.context.MessageSource}
84-
* code and arguments to resolve the detail message with.
83+
* Constructor with a message code and arguments for resolving the error
84+
* "detail" via {@link org.springframework.context.MessageSource}.
8585
* @param status the HTTP status (required)
8686
* @param reason the associated reason (optional)
8787
* @param cause a nested exception (optional)

spring-web/src/main/java/org/springframework/web/server/ServerWebInputException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public ServerWebInputException(String reason, @Nullable MethodParameter paramete
5757
}
5858

5959
/**
60-
* Constructor with a {@link org.springframework.context.MessageSource} code
61-
* and arguments to resolve the detail message with.
60+
* Constructor with a message code and arguments for resolving the error
61+
* "detail" via {@link org.springframework.context.MessageSource}.
6262
* @since 6.0
6363
*/
6464
protected ServerWebInputException(String reason, @Nullable MethodParameter parameter, @Nullable Throwable cause,

0 commit comments

Comments
 (0)