Repository navigation
chore: #2058 Use unnamed patterns in commons exception handlers - #2059
Merged
lbroudoux merged 1 commit intoApr 30, 2026
Merged
Conversation
Replace unused exception variables with the unnamed pattern '_' (JEP 456, available since Java 22) in catch blocks across the commons/util-el module. Resolves Sonar findings flagged on the 1.14.x branch for the 1.15.0 milestone. Affected sites: - NowELFunction#isInteger - RandomIntELFunction#evaluate (two catches) - RandomStringELFunction#evaluate - TemplateEngineTest#testContextlessTemplate - TemplateEngineTest#testPostmanNotationCompatibility Signed-off-by: Git-HimanshuRathi <[email protected]>
|
👋 @Git-HimanshuRathi Welcome to the Microcks community! 💖 Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly. Hope you have a great time there! |
Contributor
Author
lbroudoux
approved these changes
Apr 30, 2026
lbroudoux
left a comment
Member
There was a problem hiding this comment.
Thank you for pushing this. LGTM.
lbroudoux
pushed a commit
that referenced
this pull request
May 4, 2026
…ger (#2061) Sonar flagged two catch blocks in AsyncAPITestManager#runTest as catching Throwable. Catching Throwable swallows JVM-fatal Errors (OutOfMemoryError, StackOverflowError) that should be allowed to propagate, so narrow both to Exception. - Outer catch around invokeAny: rename t -> e and update log message and test-return reason to use the renamed variable. - Finally-block catch around messageConsumptionTask.close(): the variable is unused (best-effort cleanup), so use the unnamed pattern '_' (JEP 456, available since Java 22), matching the convention introduced in #2059. No behavioural change for the normal exception path; JVM Errors will now propagate instead of being silently turned into FAILURE test returns, which is the intended behaviour. Signed-off-by: Git-HimanshuRathi <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace unused exception variables (nfe, t) with the Java 22+ unnamed pattern (_) across the commons/util-el module, addressing 6 of the maintainability findings raised by SonarCloud and aggregated under #2058.
Sites changed
NowELFunction#isInteger
RandomIntELFunction#evaluate (two catches)
RandomStringELFunction#evaluate
TemplateEngineTest#testContextlessTemplate
TemplateEngineTest#testPostmanNotationCompatibility
Each catch body either has only a comment or calls fail(...) with a hard-coded message — the exception variable was never read.
Notes
This rule (java:S???? for unnamed patterns) became applicable after the Java 25 upgrade in #2052 / #2057.
I did not include EvaluationContextTest's newInstance Sonar finding in this PR — it's a different rule with non-trivial replacement (Class.getDeclaredConstructor().newInstance() introduces additional checked exceptions). Happy to do it as a follow-up.