Try without catch in the JDK

06 Jul 2006

The practice of using a try statement with a finally statement but without a catch statement came up on the PMD forums recently. This construct is used in a couple places in the JDK:

These examples are all from JDK 1.4; I'm not sure how prevalent this is in newer JDKs. Here's the PMD XPath rule to find this:

//TryStatement[count(CatchStatement)=0]

For much more along these lines, check out the PMD book!