ER-039 Catching too general exception type.

Severity2
Enabledyes
Waivable
Configuration
Too general exceptions to be catched:

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


Hammurapi 3 Copyright © 2004 Hammurapi Group. All Rights Reserved.