| Severity | 2 |
| Enabled | yes |
| Waivable | |
| Configuration |
Too general exceptions to be catched:
|
| Rationale | Application shall define exception hierarchy and exception handling strategy,
catching of Throwable, Exception or RuntimeException shall not be a common practice, but
be concentrated in a few classes, for which waivers shall be given. |
| Violation |
try {
InputStream is = new FileInputStream(fName);
return is.read();
} catch (Exception e) {
logger.error(FILE_ERROR_TXT, e);
throw new HammurapiTestCasesException(e);
}
|
| Fix |
try {
InputStream is = new FileInputStream(fName);
return is.read();
} catch (java.io.IOException e) {
logger.error(FILE_ERROR_TXT, e);
throw new HammurapiTestCasesException(e);
}
|