Skip to content

Commit 8eacca1

Browse files
author
Vincent Potucek
committed
fix ignored exceptions
Signed-off-by: Vincent Potucek <[email protected]>
1 parent d8ac3ff commit 8eacca1

File tree

15 files changed

+15
-29
lines changed

15 files changed

+15
-29
lines changed

integration-tests/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ void testRollbackRulesOnMethodPreventRollback() throws Exception {
158158
try {
159159
rb.echoException(new ServletException());
160160
}
161-
catch (ServletException ex) {
162-
161+
catch (ServletException ignored) {
163162
}
164163
assertThat(txMan.commits).as("Transaction counts match").isEqualTo(1);
165164
}

spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,7 @@ void serializableTargetAndAdvice() throws Throwable {
233233
try {
234234
p2.echo(new IOException());
235235
}
236-
catch (IOException ex) {
237-
236+
catch (IOException ignored) {
238237
}
239238
assertThat(cta.getCalls()).isEqualTo(2);
240239
}

spring-core/src/main/java/org/springframework/util/FileCopyUtils.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ private static void close(Closeable closeable) {
229229
try {
230230
closeable.close();
231231
}
232-
catch (IOException ex) {
233-
// ignore
232+
catch (IOException ignored) {
234233
}
235234
}
236235

spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpResponse.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ public void close() {
100100
try {
101101
getBody().close();
102102
}
103-
catch (IOException ex) {
104-
// ignore
103+
catch (IOException ignored) {
105104
}
106105
}
107106

spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpResponse.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ public void close() {
8989
this.httpResponse.close();
9090
}
9191
}
92-
catch (IOException ex) {
93-
// Ignore exception on close...
92+
catch (IOException ignored) {
9493
}
9594
}
9695

spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpResponse.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ public void close() {
108108
StreamUtils.drain(body);
109109
body.close();
110110
}
111-
catch (IOException ex) {
112-
// ignore
111+
catch (IOException ignored) {
113112
}
114113
}
115114

spring-web/src/main/java/org/springframework/web/client/HttpMessageConverterExtractor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ private static byte[] getResponseBody(ClientHttpResponse response) {
152152
try {
153153
return FileCopyUtils.copyToByteArray(response.getBody());
154154
}
155-
catch (IOException ex) {
156-
// ignore
155+
catch (IOException ignored) {
157156
}
158157
return new byte[0];
159158
}

spring-web/src/test/java/org/springframework/web/context/request/RequestContextListenerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void requestContextListenerWithDifferentThread() {
9393
try {
9494
thread.join();
9595
}
96-
catch (InterruptedException ex) {
96+
catch (InterruptedException ignored) {
9797
}
9898
// Still bound to original thread, but at least completed.
9999
assertThat(RequestContextHolder.getRequestAttributes()).isNotNull();

spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/client/MockClientHttpResponse.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ public void close() {
100100
try {
101101
getBody().close();
102102
}
103-
catch (IOException ex) {
104-
// ignore
103+
catch (IOException ignored) {
105104
}
106105
}
107106

spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceHandlerUtils.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ else if (location instanceof UrlResource) {
7676
Assert.isTrue(path.endsWith(FOLDER_SEPARATOR) || path.endsWith(WINDOWS_FOLDER_SEPARATOR),
7777
"Resource location does not end with slash: " + path);
7878
}
79-
catch (IOException ex) {
80-
// ignore
79+
catch (IOException ignored) {
8180
}
8281
}
8382

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ void closeStreamIfNecessary(InputStream body) {
191191
try {
192192
body.close();
193193
}
194-
catch (IOException ex) {
195-
// ignore
194+
catch (IOException ignored) {
196195
}
197196
}
198197

spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHandlerUtils.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ else if (location instanceof UrlResource) {
7777
Assert.isTrue(path.endsWith(FOLDER_SEPARATOR) || path.endsWith(WINDOWS_FOLDER_SEPARATOR),
7878
"Resource location does not end with slash: " + path);
7979
}
80-
catch (IOException ex) {
81-
// ignore
80+
catch (IOException ignored) {
8281
}
8382
}
8483

spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolverTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,7 @@ static class ResponseStatusTestExceptionResolver {
611611

612612
@ExceptionHandler(SocketTimeoutException.class)
613613
@ResponseStatus(code = HttpStatus.GATEWAY_TIMEOUT, reason = "gateway.timeout")
614-
public void handleException(SocketTimeoutException ex) {
615-
614+
public void handleException(SocketTimeoutException ignored) {
616615
}
617616
}
618617

spring-websocket/src/main/java/org/springframework/web/socket/handler/BinaryWebSocketHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ protected void handleTextMessage(WebSocketSession session, TextMessage message)
4141
try {
4242
session.close(CloseStatus.NOT_ACCEPTABLE.withReason("Text messages not supported"));
4343
}
44-
catch (IOException ex) {
45-
// ignore
44+
catch (IOException ignored) {
4645
}
4746
}
4847

spring-websocket/src/main/java/org/springframework/web/socket/handler/TextWebSocketHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ protected void handleBinaryMessage(WebSocketSession session, BinaryMessage messa
4141
try {
4242
session.close(CloseStatus.NOT_ACCEPTABLE.withReason("Binary messages not supported"));
4343
}
44-
catch (IOException ex) {
45-
// ignore
44+
catch (IOException ignored) {
4645
}
4746
}
4847

0 commit comments

Comments
 (0)