diff options
author | Tom Tromey <tromey@redhat.com> | 2000-12-15 06:51:07 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-12-15 06:51:07 +0000 |
commit | cd848423954f41a920c93ea9551f6c144f94dbfa (patch) | |
tree | 692af71c7a2c89ac2fb0bf4e5102c1d0e39265b6 /libjava/java | |
parent | 13b7bc8a56944cc4c88ee76ed54dbaab0b89ae54 (diff) | |
download | gcc-cd848423954f41a920c93ea9551f6c144f94dbfa.zip gcc-cd848423954f41a920c93ea9551f6c144f94dbfa.tar.gz gcc-cd848423954f41a920c93ea9551f6c144f94dbfa.tar.bz2 |
* java/util/ResourceBundle.java
(getBundle(String,Locale,ClassLoader)): New method.
(trySomeGetBundle): Added `loader' argument.
(partialGetBundle): Likewise.
From-SVN: r38275
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/util/ResourceBundle.java | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/libjava/java/util/ResourceBundle.java b/libjava/java/util/ResourceBundle.java index 639872b..99b81bf 100644 --- a/libjava/java/util/ResourceBundle.java +++ b/libjava/java/util/ResourceBundle.java @@ -73,7 +73,8 @@ public abstract class ResourceBundle // stripping off the '_' delimited tails until the search name is // the same as stopHere. private static final ResourceBundle trySomeGetBundle (String bundleName, - String stopHere) + String stopHere, + ClassLoader loader) { Class rbc; ResourceBundle needs_parent = null, r, result = null; @@ -115,9 +116,9 @@ public abstract class ResourceBundle } // Look for a properties file. - InputStream i = - ClassLoader.getSystemResourceAsStream (bundleName.replace ('.', '/') - + ".properties"); + InputStream i = loader.getResourceAsStream (bundleName.replace ('.', + '/') + + ".properties"); if (i != null) { try @@ -151,7 +152,8 @@ public abstract class ResourceBundle // Search for bundles, but stop at baseName_language (if required). // This is synchronized so that the cache works correctly. private static final synchronized ResourceBundle - partialGetBundle (String baseName, Locale locale, boolean langStop) + partialGetBundle (String baseName, Locale locale, boolean langStop, + ClassLoader loader) { ResourceBundle rb; @@ -168,7 +170,7 @@ public abstract class ResourceBundle + (langStop ? ("_" + locale.getLanguage()) : "")); - rb = trySomeGetBundle(bundleName, stopHere); + rb = trySomeGetBundle(bundleName, stopHere, loader); if (rb != null) resource_cache.put(bundleName, rb); @@ -177,6 +179,13 @@ public abstract class ResourceBundle public static final ResourceBundle getBundle (String baseName, Locale locale) + { + return getBundle (baseName, locale, ClassLoader.getSystemClassLoader ()); + } + + public static final ResourceBundle getBundle (String baseName, + Locale locale, + ClassLoader loader) throws MissingResourceException { ResourceBundle rb; @@ -185,14 +194,14 @@ public abstract class ResourceBundle if (baseName == null) throw new NullPointerException (); - rb = partialGetBundle(baseName, locale, false); + rb = partialGetBundle(baseName, locale, false, loader); if (rb != null) return rb; // Finally, try the default locale. if (! locale.equals(Locale.getDefault())) { - rb = partialGetBundle(baseName, Locale.getDefault(), true); + rb = partialGetBundle(baseName, Locale.getDefault(), true, loader); if (rb != null) return rb; } |