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

Regression in java.lang.Throwable introduced in JDK7b102

XMLWordPrintable

    • generic
    • generic

      Platforms : ALL
      JDK6 : PASSES
      JDK7 b101 : PASSES
      JDK7 b102 : FAILS

      The following code within the first try{} generates OutOfMemory error.
      When trying to print its stacktrace NPE is thrown from method of class Throwable

      public class OME {
          public static void main(String[] args) {
              try {
                  char[] chars = new char[Integer.MAX_VALUE];
              } catch (Throwable e) {
                  try {
                      e.printStackTrace();
                  } catch (NullPointerException npe) {
                      System.err.println("NPE thrown:");
                      npe.printStackTrace();
                  }
              }
          }
      }

      ----------------------------------------

      java.lang.OutOfMemoryError: Java heap space
      at OME.main(OME.java:5)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      ...
      NPE thrown:
      java.lang.NullPointerException
      at java.lang.Throwable.printStackTrace(Throwable.java:563)
      at java.lang.Throwable.printStackTrace(Throwable.java:548)
      at java.lang.Throwable.printStackTrace(Throwable.java:539)
      at OME.main(OME.java:8)
      ...

            Unassigned Unassigned
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: