You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: AvoidRethrowingException is meant to catch unnecessary catch blocks that simply rethrow the exception. However, there is an edge case that is not considered by the rule.
Expected outcome:
In the above example, one must catch and rethrow NoSuchFileException in order to avoid being caught by the IOException handler. Sometimes it is possible to refactor the code to avoid this, but sometimes it is not.
Please update the rule to ignore catching and rethrowing an exception if a later catch matches the exception's superclass.
Running PMD through: Maven
The text was updated successfully, but these errors were encountered:
Affects PMD Version: 7.0.0
Rule: https://docs.pmd-code.org/latest/pmd_rules_java_design.html#avoidrethrowingexception
Description:
AvoidRethrowingException
is meant to catch unnecessary catch blocks that simply rethrow the exception. However, there is an edge case that is not considered by the rule.Code Sample demonstrating the issue:
Expected outcome:
In the above example, one must catch and rethrow
NoSuchFileException
in order to avoid being caught by theIOException
handler. Sometimes it is possible to refactor the code to avoid this, but sometimes it is not.Please update the rule to ignore catching and rethrowing an exception if a later
catch
matches the exception's superclass.Running PMD through: Maven
The text was updated successfully, but these errors were encountered: