Synopsis: | An instanceof check is being performed on the caught exception. Create a separate catch clause for this exception type |
Language: | Java |
Severity Level: | 3 |
Category: | Design |
Description: |
Each caught exception type should be handled in its own catch clause.try { // Avoid this // do something } catch (Exception ee) { if (ee instanceof IOException) { cleanup(); } } try { // Prefer this: // do something } catch (IOException ee) { cleanup(); } |