public static SystemException unwrapSystemException ( Throwable throwable ) { if ( throwable == null ) { return null ; } else if ( throwable instanceof SystemException ) { return ( SystemException ) throwable ; } else if ( throwable . getCause ( ) != null ) { // recursive call to unwrap the cause return unwrapSystemException ( throwable . getCause ( ) ) ; } else { // didn't find any SystemException in the cause stack return null ; } }
Looks for SystemException in the cause chain .