public static Throwable extractRootCause ( Throwable t ) { Throwable result = t ; while ( result . getCause ( ) != null ) { result = result . getCause ( ) ; } return result ; }
Extracts the root cause of the exception no matter how nested it is