You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/01/12 13:03:08 UTC

svn commit: r898297 - /tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java

Author: markt
Date: Tue Jan 12 12:03:07 2010
New Revision: 898297

URL: http://svn.apache.org/viewvc?rev=898297&view=rev
Log:
Avoid NPE if bundle is missing

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java?rev=898297&r1=898296&r2=898297&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java Tue Jan 12 12:03:07 2010
@@ -109,7 +109,10 @@
         String str = null;
 
         try {
-            str = bundle.getString(key);
+            // Avoid NPE if bundle is null and treat it like an MRE
+            if (bundle != null) {
+                str = bundle.getString(key);
+            }
         } catch(MissingResourceException mre) {
             //bad: shouldn't mask an exception the following way:
             //   str = "[cannot find message associated with key '" + key + "' due to " + mre + "]";



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org