Skip to content

Commit 3badc47

Browse files
committed
Polishing
1 parent 89f66cc commit 3badc47

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ public abstract class ResponseEntityExceptionHandler {
8181
ErrorResponseException.class
8282
})
8383
public final Mono<ResponseEntity<Object>> handleException(Exception ex, ServerWebExchange exchange) {
84-
HttpHeaders headers = new HttpHeaders();
85-
8684
if (ex instanceof MethodNotAllowedException theEx) {
8785
return handleMethodNotAllowedException(theEx, theEx.getHeaders(), theEx.getStatusCode(), exchange);
8886
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ public abstract class ResponseEntityExceptionHandler {
109109
})
110110
@Nullable
111111
public final ResponseEntity<Object> handleException(Exception ex, WebRequest request) throws Exception {
112-
HttpHeaders headers = new HttpHeaders();
113-
114112
if (ex instanceof HttpRequestMethodNotSupportedException subEx) {
115113
return handleHttpRequestMethodNotSupported(subEx, subEx.getHeaders(), subEx.getStatusCode(), request);
116114
}
@@ -147,6 +145,7 @@ else if (ex instanceof ErrorResponseException subEx) {
147145

148146
// Lower level exceptions, and exceptions used symmetrically on client and server
149147

148+
HttpHeaders headers = new HttpHeaders();
150149
if (ex instanceof ConversionNotSupportedException theEx) {
151150
return handleConversionNotSupported(theEx, headers, HttpStatus.INTERNAL_SERVER_ERROR, request);
152151
}

0 commit comments

Comments
 (0)