/[classpath]/classpath/java/util/ResourceBundle.java
ViewVC logotype

Diff of /classpath/java/util/ResourceBundle.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by tromey, Mon Sep 23 17:56:16 2002 UTC revision 1.19 by mark, Sun Dec 8 23:38:59 2002 UTC
# Line 150  public abstract class ResourceBundle Line 150  public abstract class ResourceBundle
150     * second hash map is the localized name, the value is a soft     * second hash map is the localized name, the value is a soft
151     * references to the resource bundle.     * references to the resource bundle.
152     */     */
153    private static final Map resourceBundleCache = new HashMap();    private static Map resourceBundleCache;
154    
155      /**
156       * The last default Locale we saw. If this ever changes then we have to
157       * reset our caches.
158       */
159      private static Locale lastDefaultLocale;
160    
161    /**    /**
162     * The `empty' locale is created once in order to optimize     * The `empty' locale is created once in order to optimize
# Line 351  public abstract class ResourceBundle Line 357  public abstract class ResourceBundle
357    {    {
358      // This implementation searches the bundle in the reverse direction      // This implementation searches the bundle in the reverse direction
359      // and builds the parent chain on the fly.      // and builds the parent chain on the fly.
360        Locale defaultLocale = Locale.getDefault();
361        if (defaultLocale != lastDefaultLocale)
362          {
363            resourceBundleCache = new HashMap();
364            lastDefaultLocale = defaultLocale;
365          }
366      HashMap cache = (HashMap) resourceBundleCache.get(classLoader);      HashMap cache = (HashMap) resourceBundleCache.get(classLoader);
367      StringBuffer sb = new StringBuffer(60);      StringBuffer sb = new StringBuffer(60);
368      sb.append(baseName).append('_').append(locale);      sb.append(baseName).append('_').append(locale);
# Line 398  public abstract class ResourceBundle Line 410  public abstract class ResourceBundle
410      // bundle.      // bundle.
411      ResourceBundle bundle = tryLocalBundle(baseName, locale,      ResourceBundle bundle = tryLocalBundle(baseName, locale,
412                                             classLoader, baseBundle, cache);                                             classLoader, baseBundle, cache);
413      if (bundle == baseBundle && !locale.equals(Locale.getDefault()))      if (bundle == baseBundle && !locale.equals(defaultLocale))
414        {        {
415          bundle = tryLocalBundle(baseName, Locale.getDefault(),          bundle = tryLocalBundle(baseName, defaultLocale,
416                                  classLoader, baseBundle, cache);                                  classLoader, baseBundle, cache);
417          // We need to record that the argument locale maps to the          // We need to record that the argument locale maps to the
418          // bundle we just found.  If we didn't find a bundle, record          // bundle we just found.  If we didn't find a bundle, record

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26