private String generateAbbreviatedExceptionMessage ( final Throwable throwable ) { final StringBuilder builder = new StringBuilder ( ) ; builder . append ( ": " ) ; builder . append ( throwable . getClass ( ) . getCanonicalName ( ) ) ; builder . append ( ": " ) ; builder . append ( throwable . getMessage ( ) ) ; Throwable cause = throwable . getCause ( ) ; while ( cause != null ) { builder . append ( ' ' ) ; builder . append ( "Caused by: " ) ; builder . append ( cause . getClass ( ) . getCanonicalName ( ) ) ; builder . append ( ": " ) ; builder . append ( cause . getMessage ( ) ) ; // make sure the exception cause is not itself to prevent infinite // looping assert ( cause != cause . getCause ( ) ) ; cause = ( cause == cause . getCause ( ) ? null : cause . getCause ( ) ) ; } return builder . toString ( ) ; }
Method generates abbreviated exception message .