Revised supportedMethods null handling in HttpRequestMethodNotSupportedException

Issue: SPR-15377
(cherry picked from commit 5ea4abd)
This commit is contained in:
Juergen Hoeller
2017-03-24 11:06:47 +01:00
parent 2233ec04ff
commit d0177b0f55
3 changed files with 29 additions and 24 deletions

View File

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

View File

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