Java News from Wednesday, May 11, 2005

Tom Copeland has released PMD 3.1, an open source tool for automatically checking Java code for various classes of bugs. Version 3.1 improves support for Java 1.5 and adds eight new rules including:

I tried to test this on XOM, but it took way too long. I could test some packages but not others. The main complaint it had was that I wasn't using enough messages in my JUnit asserts.

Cenqua has released Clover 1.3.7, a $250 payware unit test coverage tool. 1.3.7 is a bug fix release.

Clover modifies the source code to enable it to follow which statements are executed when, and keeps a running count of how many times each statement is executed during the test suite. Any statement that executes zero times is not being tested. As usual, I tested the new release on the current XOM code base. My first run failed because I'd forgotten to copy the license file from the old Ant directory to the new Ant directory. My second attempt failed because I'd copied the wrong license file from the old Ant directory to the new Ant directory. My third through fifth attempts failed because I didn't initially understand what had gone wrong with the second attempt. My sixth attempt failed like this:

/Users/elharo/Projects/XOM/build.xml:197: java.lang.NullPointerException

Hmm, that's a really helpful error message. I'm not really sure what the problem is here.

I use Clover with Ant, but there are also versions for NetBeans, Eclipse, IntelliJ IDEA, and Oracle JDeveloper 10g. Clover can generate test coverage reports in XML, HTML, PDF, or via a Swing Viewer. Java 1.2 or later is required.