public static boolean isCompatibleWithThrowsClause ( Throwable ex , Class < ? > [ ] declaredExceptions ) { if ( ! isCheckedException ( ex ) ) { return true ; } if ( declaredExceptions != null ) { int i = 0 ; while ( i < declaredExceptions . length ) { if ( declaredExceptions [ i ] . isAssignableFrom ( ex . getClass ( ) ) ) { return true ; } i ++ ; } } return false ; }
Check whether the given exception is compatible with the exceptions declared in a throws clause .