Running the program "foo" below causes the following:
java -classic -Xcheck:jni foo
FATAL ERROR in native method: JNI received a null string
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:69)
at foo.main(foo.java:7)
The native method ends up calling jni_GetStringLength with a null argument, which causes a VM crash if -Xcheck:jni is not enabled.
See bug #4219367 for a more complete list of ZipFile constructor tests.
----------------------------------------------------------------------------
import java.util.zip.*;
public class foo {
public static void main(String[] args) {
try {
String name = null;
ZipFile zf = new ZipFile(name);
} catch (Exception e) {
if ( e instanceof NullPointerException ) {
System.out.println ("Expected NullPointerException thrown");
return;
} else {
System.out.println ("Exception thrown, but not the expected NullPointerException");
e.printStackTrace();
return;
}
}
System.out.println ("NullPointerException was not thrown");
}
}
java -classic -Xcheck:jni foo
FATAL ERROR in native method: JNI received a null string
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:69)
at foo.main(foo.java:7)
The native method ends up calling jni_GetStringLength with a null argument, which causes a VM crash if -Xcheck:jni is not enabled.
See bug #4219367 for a more complete list of ZipFile constructor tests.
----------------------------------------------------------------------------
import java.util.zip.*;
public class foo {
public static void main(String[] args) {
try {
String name = null;
ZipFile zf = new ZipFile(name);
} catch (Exception e) {
if ( e instanceof NullPointerException ) {
System.out.println ("Expected NullPointerException thrown");
return;
} else {
System.out.println ("Exception thrown, but not the expected NullPointerException");
e.printStackTrace();
return;
}
}
System.out.println ("NullPointerException was not thrown");
}
}
- duplicates
-
JDK-4198546 java.util.zip.ZipFile.ZipFile(String) dumps core
-
- Closed
-
- relates to
-
JDK-4219367 RC2_B : Crash in jniHandles.hpp, 139# with new sunsoft test
-
- Closed
-