View by Classes

Findings - Overview

filtered IllegalCatch (Checkstyle)

Catching 'Throwable' is not allowed.

Further info on the wiki.

Catching java.lang.Exception, java.lang.Error or java.lang.RuntimeException is almost never acceptable.

Rationale: Junior developers often simply catch Exception in an attempt to handle multiple exception classes. This unfortunately leads to code that inadvertantly catchs NPE, OutOfMemoryErrors, etc.

This is dangerous because if a java.lang.Error, for example OutOfMemmoryError, occurs then it will be caught. The container should handle java.lang.Error. If application code will catch them, try to log them (which will probably fail) and continue silently the situation will not be desirable.

                
SimpleDateFormat sdf = null;
try {
    sdf = new SimpleDateFormat("yyyy-MM-dd");
} catch (Throwable th) {  //Should not catch throwable
    th.printStackTrace();
}
1org.jcoderz.commons.CommonsTestRunnerSessionImpl
 [85:7]