Příklad

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$
}
}
}

Řešení
Přesuňte příkaz throw mimo blok 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$
}
}