Revised supportedMethods null handling in HttpRequestMethodNotSupportedException
Issue: SPR-15377
This commit is contained in:
@@ -227,7 +227,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);
|
||||
|
||||
@@ -368,8 +368,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