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

Copy
     public void openFile(String name) {
         try {
             FileInputStream is = new FileInputStream(name);
             // read file ...
         } catch (FileNotFoundException e) {
             // TODO Auto-generated catch block
         }
     }

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

Security training

Application security training materials provided by Secure Code Warrior.