@ Override @ GwtIncompatible ( "incompatible method" ) public String getFormattedExceptionMessage ( final String baseMessage ) { final StringBuilder buffer = new StringBuilder ( 256 ) ; if ( baseMessage != null ) { buffer . append ( baseMessage ) ; } if ( contextValues . size ( ) > 0 ) { if ( buffer . length ( ) > 0 ) { buffer . append ( ' ' ) ; } buffer . append ( "Exception Context:\n" ) ; int i = 0 ; for ( final Pair < String , Object > pair : contextValues ) { buffer . append ( "\t[" ) ; buffer . append ( ++ i ) ; buffer . append ( ' ' ) ; buffer . append ( pair . getKey ( ) ) ; buffer . append ( "=" ) ; final Object value = pair . getValue ( ) ; if ( value == null ) { buffer . append ( "null" ) ; } else { String valueStr ; try { valueStr = value . toString ( ) ; } catch ( final Exception e ) { valueStr = "Exception thrown on toString(): " + ExceptionUtils . getStackTrace ( e ) ; } buffer . append ( valueStr ) ; } buffer . append ( "]\n" ) ; } buffer . append ( "---------------------------------" ) ; } return buffer . toString ( ) ; }
Builds the message containing the contextual information .