ECC.EMPTY

An Empty Catch Clause (ECC.EMPTY) warning appears if nothing is written in a catch block. If you catch an exception, it would be better to process it rather than to ignore it.

Example 1

12     public void openFile(String name) {
13         try {
14             FileInputStream is = new FileInputStream(name);
15             // read file ...
16         } catch (FileNotFoundException e) {
17             // TODO Auto-generated catch block
18         }
19     }

ECC.EMPTY is reported for line 16: Empty catch clause

Security training

Application security training materials provided by Secure Code Warrior.