diff --git a/src/main/java/org/openrewrite/staticanalysis/CatchClauseOnlyRethrows.java b/src/main/java/org/openrewrite/staticanalysis/CatchClauseOnlyRethrows.java index 87eb10a8d..d6a577d9b 100755 --- a/src/main/java/org/openrewrite/staticanalysis/CatchClauseOnlyRethrows.java +++ b/src/main/java/org/openrewrite/staticanalysis/CatchClauseOnlyRethrows.java @@ -77,7 +77,10 @@ public J.Try visitTry(J.Try tryable, ExecutionContext ctx) { // keep this one for (int j = i + 1; j < tryable.getCatches().size(); j++) { J.Try.Catch next = tryable.getCatches().get(j); - if (!onlyRethrows(next) && hasWiderExceptionType(aCatch, next)) { + if (hasWiderExceptionType(aCatch, next)) { + if (onlyRethrows(next)) { + return null; + } return aCatch; } }