tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r898297 - /tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java
Date Tue, 12 Jan 2010 12:03:08 GMT
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


Mime
View raw message