You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by vi...@apache.org on 2015/12/23 13:10:03 UTC
svn commit: r1721528 -
/tomcat/trunk/java/org/apache/el/util/MessageFactory.java
Author: violetagg
Date: Wed Dec 23 12:10:03 2015
New Revision: 1721528
URL: http://svn.apache.org/viewvc?rev=1721528&view=rev
Log:
java.util.ResourceBundle.getString does not return null when there is no object for a given key. The method will throw MissingResourceException.
Modified:
tomcat/trunk/java/org/apache/el/util/MessageFactory.java
Modified: tomcat/trunk/java/org/apache/el/util/MessageFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/util/MessageFactory.java?rev=1721528&r1=1721527&r2=1721528&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/util/MessageFactory.java (original)
+++ tomcat/trunk/java/org/apache/el/util/MessageFactory.java Wed Dec 23 12:10:03 2015
@@ -17,6 +17,7 @@
package org.apache.el.util;
import java.text.MessageFormat;
+import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
@@ -32,14 +33,15 @@ public final class MessageFactory {
}
public static String get(final String key) {
- return bundle.getString(key);
+ try {
+ return bundle.getString(key);
+ } catch (MissingResourceException e) {
+ return key;
+ }
}
public static String get(final String key, final Object... args) {
String value = get(key);
- if (value == null) {
- value = key;
- }
MessageFormat mf = new MessageFormat(value);
return mf.format(args, new StringBuffer(), null).toString();
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org