public String getWithDefault(String code, Locale locale, String defaultMessage, Object... arguments) {
        if (locale == null) {
            throw new IllegalArgumentException("Locale must not be null");
        }
        try {
            return getMessage(code, locale, arguments);
        } catch (NoSuchMessageException ex) {
            return defaultMessage;
        }
    }
public String getWithDefault ( String code , Locale locale , String defaultMessage , Object ... arguments ) { if ( locale == null ) { throw new IllegalArgumentException ( "Locale must not be null" ) ; } try { return getMessage ( code , locale , arguments ) ; } catch ( NoSuchMessageException ex ) { return defaultMessage ; } }
Tries to resolve the specified message for the given locale.

@param code the code to lookup up, such as 'calculator.noRateSet', never {@code null}.
@param locale The Locale for which it is tried to look up the code. Must not be null
@param defaultMessage string to return if the lookup fails, never {@code null}.
@param arguments Array of arguments that will be filled in for params within the message (params look like "{0}",
"{1,date}", "{2,time}"), or {@code null} if none.
@return the resolved message, or the {@code defaultMessage} if the lookup fails.