From 696e2be8b86346cbe2eba0d9a069f5be3dae1fa7 Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 12 Jan 2010 12:03:07 +0000 Subject: [PATCH] Avoid NPE if bundle is missing 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/java/org/apache/tomcat/util/res/StringManager.java b/java/org/apache/tomcat/util/res/StringManager.java index 0b1804a24..4f3eb189e 100644 --- a/java/org/apache/tomcat/util/res/StringManager.java +++ b/java/org/apache/tomcat/util/res/StringManager.java @@ -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 + "]"; -- 2.11.0