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

(rb) confusing stack trace output on nonexistent ResourceBundle involving class literal

XMLWordPrintable

    • rc
    • x86
    • linux

      FULL PRODUCT VERSION :
      java version "1.6.0-rc"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b61)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b61, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Linux ip173 2.6.13-15-default #1 Tue Sep 13 14:56:15 UTC 2005 i686 i686 i386 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      A simple test program shows that a static initialiser can go into an endless loop while earlier releases (1.5) does not. I'm not sure the problem lies in the ResourceBundle class, but that's the only simple way I have been able to reproduce the problem.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile and run the attached test program

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Here's the output from a run with 1.5.0_05:
      Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name Main, locale en_US
              at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:837)
              at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:806)
              at java.util.ResourceBundle.getBundle(ResourceBundle.java:550)
              at Main.<init>(Main.java:4)
              at Main.main(Main.java:7)

      This is as expected, since the specified bundle does not exist.
      ACTUAL -
      The 1.6.0 b61 VM goes into an endless loop, printing exception traces:

      Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name Main, locale en_US
              at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1596)
              at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1355)
              at java.util.ResourceBundle.getBundle(ResourceBundle.java:699)
              at Main.<init>(Main.java:4)
              at Main.main(Main.java:7)
      Caused by: java.util.MissingResourceException: Can't find bundle for base name Main, locale en_US
              at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1596)
              at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1355)
              at java.util.ResourceBundle.getBundle(ResourceBundle.java:699)
              at Main.<init>(Main.java:4)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:505)
              at java.lang.Class.newInstance0(Class.java:355)
              at java.lang.Class.newInstance(Class.java:308)
              at java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:2645)
              at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1493)
              at java.util.ResourceBundle.findBundle(ResourceBundle.java:1458)
              at java.util.ResourceBundle.findBundle(ResourceBundle.java:1387)
              at java.util.ResourceBundle.findBundle(ResourceBundle.java:1387)
              at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1329)
              ... 3 more
      Caused by: java.util.MissingResourceException: Can't find bundle for base name Main, locale en_US
              at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1596)
       
      ...


      And so it goes on.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.ResourceBundle;

      public final strictfp class Main {
          private final ResourceBundle bundle = ResourceBundle.getBundle(Main.class.getName());

          public final static void main(String[] args) {
              new Main();
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Don't use the class literal for bundle names, or don't construct ResourceBundles from static initialisers.

      Release Regression From : 1.4.2
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

            okutsu Masayoshi Okutsu
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: