/** * Return string value for specified property in current locale specific ResourceBundle * * @param key * property key to look up in current ResourceBundle * @param dflt * the default value to be returned in case the property is missing * @return String value for specified property key */ public String getString(String key, String dflt) { if ( getLocale().toString().equals(DEBUG_LOCALE) ) return formatDebugPropertiesString( key ); try { return getBundle().getString(key); } catch (MissingResourceException e) { return dflt; } catch (NullPointerException e) { return dflt; } catch(ClassCastException e) { return dflt; } }
/** ** Return formatted message based on locale-specific pattern ** ** @param key maps to locale-specific pattern in properties file ** @param args parameters to format and insert according to above pattern ** @return formatted message ** ** @author Sugiura, Tatsuki (University of Nagoya) ** @author Jean-Francois Leveque (Universite Pierre et Marie Curie - Paris 6) ** **/ public String getFormattedMessage(String key, Object... args) { if ( getLocale().toString().equals(DEBUG_LOCALE) ) return formatDebugPropertiesString( key ); String pattern = (String) get(key); if (log.isDebugEnabled()) { log.debug("getFormattedMessage(key,args) bundle name=" + this.baseName + ", locale=" + getLocale().toString() + ", key=" + key + ", pattern=" + pattern); } return (new MessageFormat(pattern, getLocale())).format(args, new StringBuffer(), null).toString(); }
return new String[] { formatDebugPropertiesString(key) };
return formatDebugPropertiesString( key );