Skip to content

chore: #2058 Catch Exception instead of Throwable in AsyncAPITestManager - #2061

Merged
lbroudoux merged 1 commit into
microcks:masterfrom
Heyy-Himanshuu:chore/2058-catch-exception-asyncapi
May 4, 2026
Merged

lbroudoux merged 1 commit into
microcks:masterfrom
Heyy-Himanshuu:chore/2058-catch-exception-asyncapi

Conversation

@Heyy-Himanshuu

Copy link
Copy Markdown
Contributor

Description

  • minions/async — AsyncAPITestManager#runTest: outer catch around executorService.invokeAny narrowed from Throwable to Exception; variable renamed t → e and the log message and test-return reason text updated to match (rule: java:S1181, L141).
  • minions/async — AsyncAPITestManager#runTest: finally-block catch around messageConsumptionTask.close() narrowed from Throwable to Exception. The variable is unused (best-effort cleanup), so the unnamed pattern _ is used (JEP 456, Java 22+), matching the convention introduced in chore: #2058 Use unnamed patterns in commons exception handlers #2059 (rule: java:S1181, L150).
  • 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 for fatal conditions like OutOfMemoryError.
  • mvn spotless:check -pl minions/async passes locally.

Related issue(s)

See also #2058

…TestManager

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 microcks#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]>
@Heyy-Himanshuu

Copy link
Copy Markdown
Contributor Author

@lbroudoux

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lbroudoux lbroudoux added kind/task java Pull requests that update Java code labels May 4, 2026
@lbroudoux lbroudoux added this to the 1.15.0 milestone May 4, 2026
@lbroudoux
lbroudoux merged commit 8edea3b into microcks:master May 4, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update Java code kind/task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants