public String getShortMessage ( Locale locale ) { String message ; message = translate ( Integer . toString ( exceptionCode ) , locale ) ; if ( message != null && msgParameters != null && msgParameters . length > 0 ) { for ( int i = 0 ; i < msgParameters . length ; i ++ ) { boolean isIncluded = false ; String needTranslationParam = "$${" + i + "}" ; if ( message . contains ( needTranslationParam ) ) { String translation = translate ( msgParameters [ i ] , locale ) ; if ( null == translation && null != msgParameters [ i ] ) { translation = msgParameters [ i ] . toString ( ) ; } if ( null == translation ) { translation = "[null]" ; } message = message . replace ( needTranslationParam , translation ) ; isIncluded = true ; } String verbatimParam = "${" + i + "}" ; String rs = null == msgParameters [ i ] ? "[null]" : msgParameters [ i ] . toString ( ) ; if ( message . contains ( verbatimParam ) ) { message = message . replace ( verbatimParam , rs ) ; isIncluded = true ; } if ( ! isIncluded ) { message = message + " (" + rs + ")" ; // NOSONAR replace/contains makes StringBuilder use difficult } } } return message ; }
Get the short exception message using the requested locale . This does not include the cause exception message .