Rename exception variables in empty catch blocks
The Spring codebase sometimes ignores exceptions in catch blocks on purpose. This is often called out by an inline comment. We should make this more obvious by renaming the exception argument in the catch block to declare whether the exception is "ignored" or "expected". See gh-35047 Signed-off-by: Vincent Potucek <vpotucek@me.com> [brian.clozel@broadcom.com: rework commit message] Signed-off-by: Brian Clozel <brian.clozel@broadcom.com>
This commit is contained in:
committed by
Brian Clozel
parent
cd3ac44fb0
commit
0d4dfb6c1f
@@ -77,8 +77,7 @@ abstract class WebClientUtils {
|
||||
try {
|
||||
uri = new URI(uri.getScheme(), null, uri.getHost(), uri.getPort(), uri.getPath(), null, null);
|
||||
}
|
||||
catch (URISyntaxException ex) {
|
||||
// ignore
|
||||
catch (URISyntaxException ignored) {
|
||||
}
|
||||
}
|
||||
return httpMethod.name() + " " + uri;
|
||||
|
||||
@@ -357,8 +357,7 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder {
|
||||
.cache();
|
||||
}
|
||||
}
|
||||
catch (InvalidMediaTypeException ex) {
|
||||
// Ignore
|
||||
catch (InvalidMediaTypeException ignored) {
|
||||
}
|
||||
return EMPTY_FORM_DATA;
|
||||
}
|
||||
@@ -379,8 +378,7 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder {
|
||||
.cache();
|
||||
}
|
||||
}
|
||||
catch (InvalidMediaTypeException ex) {
|
||||
// Ignore
|
||||
catch (InvalidMediaTypeException ignored) {
|
||||
}
|
||||
return EMPTY_MULTIPART_DATA;
|
||||
}
|
||||
|
||||
@@ -76,8 +76,7 @@ public abstract class ResourceHandlerUtils {
|
||||
Assert.isTrue(path.endsWith(FOLDER_SEPARATOR) || path.endsWith(WINDOWS_FOLDER_SEPARATOR),
|
||||
"Resource location does not end with slash: " + path);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
// ignore
|
||||
catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,8 +211,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
|
||||
return EMPTY_CONDITION;
|
||||
}
|
||||
}
|
||||
catch (NotAcceptableStatusException | UnsupportedMediaTypeStatusException ex) {
|
||||
// Ignore
|
||||
catch (NotAcceptableStatusException | UnsupportedMediaTypeStatusException ignored) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user