| Severity | 2 |
|---|---|
| Enabled | yes |
| Waivable | |
| Configuration |
Not allowed exceptions: exception: java.lang.RuntimeException exception: java.lang.Exception exception: java.lang.Throwable |
| Rationale | Application shall define exception handling strategy and own exception classes to throw, |
| Violation |
public int getFirstByte(final String fName)throws Exception {
InputStream is = new FileInputStream(fName);
return is.read();
}
|
| Fix |
public int getFirstByte(final String fName)throws HammurapiTestCasesException {
try {
InputStream is = new FileInputStream(fName);
return is.read();
} catch (java.io.IOException e) {
logger.error(FILE_ERROR_TXT, e);
throw new HammurapiTestCasesException(e);
}
}
|