Browse Source

Polishing

pull/28821/head
rstoyanchev 4 years ago
parent
commit
3badc47647
  1. 2
      spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityExceptionHandler.java
  2. 3
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java

2
spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityExceptionHandler.java

@ -81,8 +81,6 @@ public abstract class ResponseEntityExceptionHandler { @@ -81,8 +81,6 @@ public abstract class ResponseEntityExceptionHandler {
ErrorResponseException.class
})
public final Mono<ResponseEntity<Object>> handleException(Exception ex, ServerWebExchange exchange) {
HttpHeaders headers = new HttpHeaders();
if (ex instanceof MethodNotAllowedException theEx) {
return handleMethodNotAllowedException(theEx, theEx.getHeaders(), theEx.getStatusCode(), exchange);
}

3
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java

@ -109,8 +109,6 @@ public abstract class ResponseEntityExceptionHandler { @@ -109,8 +109,6 @@ public abstract class ResponseEntityExceptionHandler {
})
@Nullable
public final ResponseEntity<Object> handleException(Exception ex, WebRequest request) throws Exception {
HttpHeaders headers = new HttpHeaders();
if (ex instanceof HttpRequestMethodNotSupportedException subEx) {
return handleHttpRequestMethodNotSupported(subEx, subEx.getHeaders(), subEx.getStatusCode(), request);
}
@ -147,6 +145,7 @@ public abstract class ResponseEntityExceptionHandler { @@ -147,6 +145,7 @@ public abstract class ResponseEntityExceptionHandler {
// Lower level exceptions, and exceptions used symmetrically on client and server
HttpHeaders headers = new HttpHeaders();
if (ex instanceof ConversionNotSupportedException theEx) {
return handleConversionNotSupported(theEx, headers, HttpStatus.INTERNAL_SERVER_ERROR, request);
}

Loading…
Cancel
Save