/**
* 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
*/
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
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;
}
}
// STATIC SUPPORT METHODS
// --------------------------------------------------------------
- private static Hashtable<String, StringManager> managers =
+ private static final Hashtable<String, StringManager> managers =
new Hashtable<String, StringManager>();
/**