Revised supportedMethods null handling in HttpRequestMethodNotSupportedException

Issue: SPR-15377
This commit is contained in:
Juergen Hoeller
2017-03-24 11:06:47 +01:00
parent b73153cd7c
commit 5ea4abdb85
3 changed files with 29 additions and 24 deletions

View File

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

View File

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