public static Throwable getNextThrowable ( Throwable t ) { Throwable nextThrowable = null ; if ( t != null ) { // try getCause first. nextThrowable = t . getCause ( ) ; if ( nextThrowable == null ) { // if getCause returns null, look for the JDBC and JCA specific chained exceptions // in case the resource adapter or database has not implemented getCause and initCause yet. if ( t instanceof SQLException ) { nextThrowable = ( ( SQLException ) t ) . getNextException ( ) ; } else if ( t instanceof ResourceException ) { nextThrowable = ( ( ResourceException ) t ) . getCause ( ) ; } } } return nextThrowable ; }
Finds the next Throwable object from the one provided .