Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4050902

ResourceBundle prints a lot of unnecessary exceptions when loading bundles

    XMLWordPrintable

Details

    • 1.1.6
    • generic, x86, sparc
    • generic, solaris_2.5.1, windows_95, windows_nt
    • Verified

    Backports

      Description

        When "getBundle" is searching for an appropriate bundle for a bundle
        name and locale, it complains along the way about every bundle it
        doesn't find even if an appropriate bundle is later found. For example,
        if you are looking for a bundle name of FooBundle and the locale
        fr_FR....getBundle prints an exception about not finding FooBundle_fr_FR
        even if it later finds FooBundle_fr.

        It's so noisy that it obscures any real errors that the program might
        be generating.



        ingrid.yao@Eng 1998-01-20

        Oracle still see the problem on 1.1.6D build. with the following
        error messages show on console:

         can't find resource for sun.awt.windows.awtLocalization_en_US
         Using default MenuItem font

        When Java looks for language/territory specific resource bundles, it reports
        unnecessary exceptions even when it finds the resource bundles it is looking
        for. Please note that this bug is *not* about any stack trace output when
        using the resource bundles; this bug is about the exceptions.
         
        Previously, Oracle filed 4060778 (ResouceBundle/AppletClassLoader
        interaction
        bug), which was about both the stack trace output *and* the exceptions
        generated when using resource bundles. 4060778 was marked as fixed in 1.1.4,
        but only the stack trace output was fixed, and the exceptions were not
        addressed. 4050902 dealt solely with the exceptions, but JavaSoft mistakenly
        closed this bug as fixed too.
         
        So JavaSoft closed both 4060778 and 4050902 thinking the bug had been fully
        fixed, even though they've only addressed the stack trace part. Oracle need to
        reopen 4050902 to address the exceptions.
         
        Feb 3, 1998 Marianne Mueller:
        Oracle finds that this bug is present in 1.1.6F. This is one of Oracle's
        must-fix bugs for 1.1.6FCS. Here's a test case from Oracle:

        BuggyBundle.html:
        <applet code="BuggyLoader" height=50 width=100></applet>

        BuggyBundle.java:
        import java.util.ListResourceBundle;
        public class BuggyBundle extends ListResourceBundle
        {
            public Object[][] getContents()
            {
                return sMessageStrings;
            }
            static final private Object[][] sMessageStrings =
            {
                {"ACCCLS","FRM-99999: Internal Error: Failed to access Java Class.\nFull Details: {0}"}
            };
        }

        BuggyLoader.java:
        import java.util.*;
        import java.applet.*;
        import java.awt.*;
        public class BuggyLoader
               extends Applet
        {
            public BuggyLoader()
            {
                add(new TextField(getMessage("ACCCLS", Locale.getDefault())));
            }
            public void start()
            {
            }
            public final String getMessage(String key, Locale locale)
            {
                String formattedMsg;
                try
                {
                    ResourceBundle msgBundle = ResourceBundle.getBundle("BuggyBundle",
                                                                        locale);
                    formattedMsg = msgBundle.getString(key);
                }
                catch ( Exception e )
                {
                    formattedMsg = "error: " + e.toString();
                }
                return formattedMsg;
            }
        }



        When this is run from appletviewer, the console window displays
        "File not found when looking for: BuggyBundle_en" a number of times.

        Attachments

          Issue Links

            Activity

              People

                dconnellsunw David Connelly (Inactive)
                duke J. Duke
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: