diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-12-08 23:38:02 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-12-08 23:38:02 +0000 |
commit | f3782e9bd70c6eae9d91d261c091686ac4dc8c0b (patch) | |
tree | 0428606bc42926355571268cacfa44d7ecf4659c /libjava/java | |
parent | bfa756ab5f52883f96de3a605170c3876c03b0d8 (diff) | |
download | ppe42-gcc-f3782e9bd70c6eae9d91d261c091686ac4dc8c0b.tar.gz ppe42-gcc-f3782e9bd70c6eae9d91d261c091686ac4dc8c0b.zip |
* java/util/ResourceBundle.java (resourceBundleCache): Not final.
(lastDefaultLocale): New field.
(getBundle): When Locale.getDefault != lastDefaultLocale reset
resourceBundleCache.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59948 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/util/ResourceBundle.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/libjava/java/util/ResourceBundle.java b/libjava/java/util/ResourceBundle.java index ecc63af2596..2a4e34887c4 100644 --- a/libjava/java/util/ResourceBundle.java +++ b/libjava/java/util/ResourceBundle.java @@ -111,7 +111,13 @@ public abstract class ResourceBundle * second hash map is the localized name, the value is a soft * references to the resource bundle. */ - private static final Map resourceBundleCache = new HashMap(); + private static Map resourceBundleCache; + + /** + * The last default Locale we saw. If this ever changes then we have to + * reset our caches. + */ + private static Locale lastDefaultLocale; /** * The `empty' locale is created once in order to optimize @@ -312,6 +318,12 @@ public abstract class ResourceBundle { // This implementation searches the bundle in the reverse direction // and builds the parent chain on the fly. + Locale defaultLocale = Locale.getDefault(); + if (defaultLocale != lastDefaultLocale) + { + resourceBundleCache = new HashMap(); + lastDefaultLocale = defaultLocale; + } HashMap cache = (HashMap) resourceBundleCache.get(classLoader); StringBuffer sb = new StringBuffer(60); sb.append(baseName).append('_').append(locale); @@ -359,9 +371,9 @@ public abstract class ResourceBundle // bundle. ResourceBundle bundle = tryLocalBundle(baseName, locale, classLoader, baseBundle, cache); - if (bundle == baseBundle && !locale.equals(Locale.getDefault())) + if (bundle == baseBundle && !locale.equals(defaultLocale)) { - bundle = tryLocalBundle(baseName, Locale.getDefault(), + bundle = tryLocalBundle(baseName, defaultLocale, classLoader, baseBundle, cache); // We need to record that the argument locale maps to the // bundle we just found. If we didn't find a bundle, record |