Avoid NPE if bundle is missing
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 12 Jan 2010 12:03:07 +0000 (12:03 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 12 Jan 2010 12:03:07 +0000 (12:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@898297 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/res/StringManager.java

index 0b1804a..4f3eb18 100644 (file)
@@ -109,7 +109,10 @@ public class StringManager {
         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 + "]";