예제

public static void main( String[] args ) {
int number = 0;
try {
number = Integer.parseInt( args[ 0 ] );
} finally {
System.out.println( "finally clause" ); //$NON-NLS-1$
if ( number == 0 ) {
throw new IllegalArgumentException( "Bad argument" ); //$NON-NLS-1$
}
}
}

솔루션
throw 문을 finally 블록 외부로 이동하십시오.

public static void main( String[] args ) {
int number = 0;
try {
number = Integer.parseInt( args[ 0 ] );
} finally {
System.out.println( "finally clause" ); //$NON-NLS-1$
}

if ( number == 0 ) {
throw new IllegalArgumentException( "Bad argument" ); //$NON-NLS-1$
}
}