Revised supportedMethods null handling in HttpRequestMethodNotSupportedException
Issue: SPR-15377
(cherry picked from commit 5ea4abd)
This commit is contained in:
@@ -252,7 +252,7 @@ public abstract class ResponseEntityExceptionHandler {
|
||||
pageNotFoundLogger.warn(ex.getMessage());
|
||||
|
||||
Set<HttpMethod> supportedMethods = ex.getSupportedHttpMethods();
|
||||
if (!supportedMethods.isEmpty()) {
|
||||
if (!CollectionUtils.isEmpty(supportedMethods)) {
|
||||
headers.setAllow(supportedMethods);
|
||||
}
|
||||
return handleExceptionInternal(ex, null, headers, status, request);
|
||||
|
||||
@@ -375,8 +375,7 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
||||
// Check whether we should support the request method.
|
||||
String method = request.getMethod();
|
||||
if (this.supportedMethods != null && !this.supportedMethods.contains(method)) {
|
||||
throw new HttpRequestMethodNotSupportedException(
|
||||
method, StringUtils.toStringArray(this.supportedMethods));
|
||||
throw new HttpRequestMethodNotSupportedException(method, this.supportedMethods);
|
||||
}
|
||||
|
||||
// Check whether a session is required.
|
||||
|
||||
Reference in New Issue
Block a user