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

(rb) DateFormatSymbols causes recursive invocation exception

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.4.2
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      FULL PRODUCT VERSION :
      java version "1.4.2_08"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b03)
      Java HotSpot(TM) Client VM (build 1.4.2_08-b03, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      calling the DateFormatSymbols constructor (directly or indirectly) from the constructor of a ClassLoader that is specified as the java.system.class.loader gives the following exception and JVM termination:

      Error occurred during initialization of VM
      java.lang.Error: java.lang.IllegalStateException: recursive invocation


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      The following class can be used to reproduce this error:

      package tests;

      import java.text.DateFormatSymbols;

      public class BrokenClassLoader extends ClassLoader
      {
        public BrokenClassLoader(ClassLoader parent)
        {
          super(parent);
          try
          {
            new DateFormatSymbols();
          }
          catch (RuntimeException e)
          {
            e.printStackTrace();
            throw e;
          }
        }
        
        public static void main(String[] args)
        {
          System.out.println("hello");
        }
      }

      call using the following command:
      java -Djava.system.class.loader=tests.BrokenClassLoader tests.BrokenClassLoader

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I excepted it to not throw an exception
      ACTUAL -
      It threw an exception

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      On 1.4.2.09 and 1.5.0.05 -

      java.lang.IllegalStateException: recursive invocation
      at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1139)
      at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1122)
      at java.util.ResourceBundle.getLoader(ResourceBundle.java:398)
      at java.util.ResourceBundle.getBundle(ResourceBundle.java:579)
      at sun.text.resources.LocaleData$1.run(LocaleData.java:113)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.text.resources.LocaleData.getBundle(LocaleData.java:111)
      at sun.text.resources.LocaleData.getLocaleElements(LocaleData.java:99)
      at java.text.DateFormatSymbols.cacheLookup(DateFormatSymbols.java:417)
      at java.text.DateFormatSymbols.initializeData(DateFormatSymbols.java:468)
      at java.text.DateFormatSymbols.<init>(DateFormatSymbols.java:90)
      at tests.BrokenClassLoader.<init>(BrokenClassLoader.java:12)
      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:274)
      at java.lang.SystemClassLoaderAction.run(ClassLoader.java:1853)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1147)
      at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1122)
      Error occurred during initialization of VM
      java.lang.Error: java.lang.IllegalStateException: recursive invocation

      On Mustang Build 53
      Error occurred during initialization of VM
      java.lang.ExceptionInInitializerError
             at java.util.ResourceBundle.getLoader(ResourceBundle.java:411)
             at java.util.ResourceBundle.getBundle(ResourceBundle.java:816)
             at sun.util.resources.LocaleData$1.run(LocaleData.java:127)
             at java.security.AccessController.doPrivileged(Native Method)
             at sun.util.resources.LocaleData.getBundle(LocaleData.java:125)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package tests;

      import java.text.DateFormatSymbols;

      public class BrokenClassLoader extends ClassLoader
      {
        public BrokenClassLoader(ClassLoader parent)
        {
          super(parent);
          try
          {
            new DateFormatSymbols();
          }
          catch (RuntimeException e)
          {
            e.printStackTrace();
            throw e;
          }
        }
        
        public static void main(String[] args)
        {
          System.out.println("hello");
        }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Avoid using DateFormatSymbols() or anything that calls it. Unfortunately, this includes avoiding java.util.Date.toString()

        Attachments

          Activity

            People

            • Assignee:
              peytoia Yuka Kamiya (Inactive)
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: