TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - Java Coding Standard
Search

Rule:  Design30Checked automatically with code checker

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();
}