tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r962919 - /tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java
Date Sat, 10 Jul 2010 21:22:13 GMT
Author: markt
Date: Sat Jul 10 21:22:12 2010
New Revision: 962919

URL: http://svn.apache.org/viewvc?rev=962919&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49442
Trivial code clean-up. No functional change.
Based on a patch provided by Sebb.

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=962919&r1=962918&r2=962919&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java Sat Jul 10 21:22:12 2010
@@ -55,8 +55,8 @@ public class StringManager {
     /**
      * The ResourceBundle for this StringManager.
      */
-    private ResourceBundle bundle;
-    private Locale locale;
+    private final ResourceBundle bundle;
+    private final Locale locale;
 
     /**
      * Creates a new StringManager for a given package. This is a
@@ -68,8 +68,9 @@ public class StringManager {
      */
     private StringManager(String packageName) {
         String bundleName = packageName + ".LocalStrings";
+        ResourceBundle bnd = null;
         try {
-            bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault());
+            bnd = ResourceBundle.getBundle(bundleName, Locale.getDefault());
         } catch( MissingResourceException ex ) {
             // Try from the current loader (that's the case for trusted apps)
             // Should only be required if using a TC5 style classloader structure
@@ -77,16 +78,19 @@ public class StringManager {
             ClassLoader cl = Thread.currentThread().getContextClassLoader();
             if( cl != null ) {
                 try {
-                    bundle = ResourceBundle.getBundle(
+                    bnd = ResourceBundle.getBundle(
                             bundleName, Locale.getDefault(), cl);
                 } catch(MissingResourceException ex2) {
                     // Ignore
                 }
             }
         }
+        bundle = bnd;
         // Get the actual locale, which may be different from the requested one
         if (bundle != null) {
             locale = bundle.getLocale();
+        } else {
+            locale = null;
         }
     }
 
@@ -152,7 +156,7 @@ public class StringManager {
     // STATIC SUPPORT METHODS
     // --------------------------------------------------------------
 
-    private static Hashtable<String, StringManager> managers =
+    private static final Hashtable<String, StringManager> managers =
         new Hashtable<String, StringManager>();
 
     /**



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


Mime
View raw message