Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 40908 invoked from network); 10 Jul 2010 21:23:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 10 Jul 2010 21:23:41 -0000 Received: (qmail 51008 invoked by uid 500); 10 Jul 2010 21:23:40 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 50948 invoked by uid 500); 10 Jul 2010 21:23:39 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 50939 invoked by uid 99); 10 Jul 2010 21:23:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Jul 2010 21:23:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Jul 2010 21:23:37 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EA0C323889E7; Sat, 10 Jul 2010 21:22:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r962919 - /tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java Date: Sat, 10 Jul 2010 21:22:13 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100710212213.EA0C323889E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 managers = + private static final Hashtable managers = new Hashtable(); /** --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org