ER-052 Do not use printStackTrace(), use logger(, ) instead.

Severity1
Enabledyes
Waivable
Violation
public int getFirstByte(final String fName) { 
	try {
		InputStream is = new FileInputStream(fName);
		return is.read();
	} catch (IOException e) {
		e.printStackTrace();
		return 0;
	}
}
Fix
public int getFirstByte(final String fName)throws HammurapiTestCasesException {
	try {
		InputStream is = new FileInputStream(fName);
		return is.read();
	} catch (IOException e) {
		logger.error(FILE_ERROR_TXT, e);
		throw new HammurapiTestCasesException(e);
	}
}


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