ER-095 Too many exceptions listed in throws clause

Severity2
Enabledyes
Waivable
Configuration
Allowed maximum item in the throws clause:
max-throws: 3
Violation
public static TooManyThrowsRuleViolationTestCase readIn(final String fName)
	throws FileNotFoundException, IOException, ClassNotFoundException,StreamCorruptedException {
	InputStream is = new FileInputStream(fName);
	ObjectInputStream ois = new ObjectInputStream(is);
	TooManyThrowsRuleViolationTestCase obj =
	(TooManyThrowsRuleViolationTestCase) ois.readObject();
	return obj;
}
Fix
public static TooManyThrowsRuleFixTestCase readIn(final String fName)throws HammurapiTestCasesException { 
	TooManyThrowsRuleFixTestCase obj = null;
	try {
		InputStream is = new FileInputStream(fName);
		ObjectInputStream ois = new ObjectInputStream(is);
		obj = (TooManyThrowsRuleFixTestCase) ois.readObject();
	} catch (FileNotFoundException e) {
		logger.error(SERIALIZATION_ERROR + e.getMessage());
		throw new HammurapiTestCasesException(e);
	} catch (ClassNotFoundException e) {
		logger.error(SERIALIZATION_ERROR + e.getMessage());
		throw new HammurapiTestCasesException(e);
	} catch (StreamCorruptedException e) {
		logger.error(SERIALIZATION_ERROR + e.getMessage());
		throw new HammurapiTestCasesException(e);
	} catch (IOException e) {
		logger.error(SERIALIZATION_ERROR + e.getMessage());
		throw new HammurapiTestCasesException(e);
	}
	return obj;
}


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