ER-072 Avoid using constructors in the 'clone ()' method

Severity1
Enabledyes
Waivable
Violation
public Object clone() {
	ConstructorsInCloneRuleViolationTestCase other =New ConstructorsInCloneRuleViolationTestCase();
	other.name = name;
	return other;
}
Fix
public Object clone() {
	ConstructorsInCloneRuleFixTestCase other = null;
	try {
		other = (ConstructorsInCloneRuleFixTestCase) super.clone();
		other.name = name;
		} catch (CloneNotSupportedException e) {
			logger.error(CLONE_ERROR_TXT, e);
		}
		return other;
}


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