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:
Vincent Potucek
2025-06-13 16:03:24 +02:00
committed by Brian Clozel
parent cd3ac44fb0
commit 0d4dfb6c1f
46 changed files with 66 additions and 108 deletions

View File

@@ -73,7 +73,8 @@ class BridgeMethodResolver {
} finally {
is.close();
}
} catch (IOException ignored) {}
} catch (IOException ignored) {
}
}
return resolved;
}

View File

@@ -62,8 +62,8 @@ public class MethodProxy {
try {
proxy.init();
}
catch (CodeGenerationException ex) {
// Ignore - to be retried when actually needed later on (possibly not at all)
catch (CodeGenerationException ignored) {
// to be retried when actually needed later on (possibly not at all)
}
}
// SPRING PATCH END

View File

@@ -438,8 +438,7 @@ public class SpringFactoriesLoader {
return constructor;
}
}
catch (UnsupportedOperationException ex) {
// ignore
catch (UnsupportedOperationException ignored) {
}
return null;
}

View File

@@ -229,8 +229,7 @@ public abstract class FileCopyUtils {
try {
closeable.close();
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
}