Exceptional ... exception management - Sometimes they come back

From AWiki

Jump to: navigation, search


Real case of never-tested production code that ever throws ArrayIndexOutOfboundException during exception management: in application log the original exception is masked by the ArrayIndexOutOfboundException raised by management code.

try {
	result = callSomeMethod(...);
} catch(Exception e) {
	String[] messages = new String[3];
	messages[0] = ... ;
	messages[1] = ... ;
	messages[2] = ... ;
	messages[3] = ... ; // throws ever ArrayIndexOutOfBoundException
	throw new CustomException(messages);
}
Personal tools