List of usage examples for java.util MissingResourceException getStackTrace
public StackTraceElement[] getStackTrace()
From source file:org.sakaiproject.util.ResourceLoader.java
/** * Return string value for specified property in current locale specific ResourceBundle * * @param key property key to look up in current ResourceBundle * @return String value for specified property key *//*from w w w. ja v a 2 s . c o m*/ public String getString(String key) { if (getLocale().toString().equals(DEBUG_LOCALE)) { return formatDebugPropertiesString(key); } try { String value = getBundle().getString(key); if (M_log.isDebugEnabled()) { M_log.debug("getString(key) bundle name=" + this.baseName + ", locale=" + getLocale().toString() + ", key=" + key + ", value=" + value); } return value; } catch (MissingResourceException e) { if (M_log.isWarnEnabled()) { M_log.warn( "bundle \'" + baseName + "\' missing key: \'" + key + "\' from: " + e.getStackTrace()[3]); // 3-deep gets us out of ResourceLoader } return "[missing key (mre): " + baseName + " " + key + "]"; } catch (NullPointerException e) { if (M_log.isWarnEnabled()) { M_log.warn("bundle \'" + baseName + "\' null pointer exception: \'" + key + "\' from: " + e.getStackTrace()[3]); // 3-deep gets us out of ResourceLoader } return "[missing key (npe): " + baseName + " " + key + "]"; } catch (ClassCastException e) { if (M_log.isWarnEnabled()) { M_log.warn("bundle \'" + baseName + "\' class cast exception: \'" + key + "\' from: " + e.getStackTrace()[3]); // 3-deep gets us out of ResourceLoader } return "[missing key (clc): " + baseName + " " + key + "]"; } }