InspectionGadgets: erroneous 'Overly broad catch block' reported

IG erroneously reports that a catch clause is too broad, even if the guarded code calls a method which actually does throw the broad exception class in question.

In particular, I noticed this in a try block that throws both Exception and XyzException. IG reports: "Catch of Exception is too broad, masking exception XyzException".

1 comment


This is actually the intended behaviour of this inspection, the idea being that the construction you describe throws away information about XyzException.

--Dave Griffith

0

Please sign in to leave a comment.