-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
7
-
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)
...
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)
...
- duplicates
-
JDK-6973831 NPE when printing stack trace of OOME
- Closed