Skip to content

Commit 1e3ec20

Browse files
author
Vincent Potucek
committed
fix ignored exceptions
Signed-off-by: Vincent Potucek <[email protected]>
1 parent 2e086bd commit 1e3ec20

File tree

11 files changed

+11
-22
lines changed

11 files changed

+11
-22
lines changed

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) { exception on close...
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/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-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)