Problems with gnu.gcj.text.LocaleData

Anthony Green green@redhat.com
Tue Sep 4 07:13:00 GMT 2001


Can we cache the resource bundles we attempt to load in java.text?  In
debugging the core:/ protocol code yesterday, I noticed that some programs
frequently try to open files which are variations of gnu/gcj/text/LocaleData.

I'm talking about code like this in libjava/java/text/NumberFormat.java....

  private static final NumberFormat computeInstance (Locale loc,
                                                     String resource,
                                                     String def)
    {
      ResourceBundle res;
      try
        {
          res = ResourceBundle.getBundle("gnu.gcj.text.LocaleData", loc);
        }
      catch (MissingResourceException x)
        {
          res = null;
        }

There's another problem here.  java.util.ResouceBundle.getBundle says....

    ResourceBundle baseBundle = tryBundle(baseName, new Locale("", ""),
                                          classLoader, null, cache);
    if (baseBundle == null)
      // JDK says, that if one provides a bundle base_en_UK, one
      // must also provide the bundles base_en and base.
      // This implies that if there is no bundle for base, there
      // is no bundle at all.
      throw new MissingResourceException("Bundle not found", baseName, "");

However, we only provide gnu.gcj.text.LocaleData_en and
gnu.gcj.text.LocaleData_en_US, so these are never loaded.

AG




More information about the Java mailing list