Inspection Gadgets: throw ignores caught exception false positives

Hi there,

IG finds the following false positive all over my codebase when I look for
"throw inside catch block that ignores the caught exception" cases.
Not sure what's special about this one, IG behaves correctly in other
instances. Maybe the checked/unchecked wrapping, or something.

Andrei

} catch (SQLException e) {
throw new EJBException(e);
}








Attachment(s):
ThrowFalsePositive.png
2 comments


The trick is I was looking for calls to constructors which took "Throwable" as an arg. That's how it should be done post JDK1.4, since that's how wrapping of exceptions is done there. On older classes, people often implemented exception wrapping themselves, and often had their constructors take "Exception" rather than "Throwable" as an arg. This is what EJBException did, in this example. In any case, I've already had reports of this and I've already got a fix. It'll be in 0.0.11, sometime between two days and four weeks from now.

--Dave

0

Great, thanks.

Andrei

"Dave Griffith" <dave.griffith@cnn.com> wrote in message
news:27659893.1077047657129.JavaMail.itn@is.intellij.net...
>

The trick is I was looking for calls to constructors which took

"Throwable" as an arg. That's how it should be done post JDK1.4, since
that's how wrapping of exceptions is done there. On older classes, people
often implemented exception wrapping themselves, and often had their
constructors take "Exception" rather than "Throwable" as an arg. This is
what EJBException did, in this example. In any case, I've already had
reports of this and I've already got a fix. It'll be in 0.0.11, sometime
between two days and four weeks from now.
>

--Dave



0

Please sign in to leave a comment.