Author: markt
Date: Mon Jul 13 21:49:14 2009
New Revision: 793722
URL: http://svn.apache.org/viewvc?rev=793722&view=rev
Log:
Prep required for the o.a.tomcat.util.res.StringManager to replace the
o.a.c.util.StringManager
Adds handling for when classloaders common != server != shared
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=793722&r1=793721&r2=793722&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java Mon Jul 13
21:49:14 2009
@@ -68,9 +68,25 @@
*/
private StringManager(String packageName) {
String bundleName = packageName + ".LocalStrings";
- bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault());
+ try {
+ bundle = 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
+ // where common != shared != server
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if( cl != null ) {
+ try {
+ bundle = ResourceBundle.getBundle(
+ bundleName, Locale.getDefault(), cl);
+ } catch(MissingResourceException ex2) {
+ }
+ }
+ }
// Get the actual locale, which may be different from the requested one
- locale = bundle.getLocale();
+ if (bundle != null) {
+ locale = bundle.getLocale();
+ }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]