-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
1.3.0
-
sparc
-
solaris_7
Name: rmT116609 Date: 03/28/2001
$ java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)
The JVM crashes when leaving native code when a nested exception has been
thrown. The following code crashes consistantly on Solaris 2.7 under Java 1.3
(with both "-client" and "-server") and Java1.2.2_05a:
*** JAVA CLASSES ***
public class Test {
static {
System.loadLibrary("test");
}
public static void main(String args[]) throws Exception {
throwException();
}
private static final native void throwException() throws Exception;
}
class NestedException extends Exception {
Throwable cause = null;
NestedException(String msg) {
super(msg);
}
NestedException(String msg, Throwable cause) {
super(msg);
this.cause = cause;
}
}
*** Native function ***
#include "Test.h"
JNIEXPORT void JNICALL Java_Test_throwException(JNIEnv *env, jclass jthis) {
jclass clazz = env->FindClass("NestedException");
if (clazz == NULL) {
return;
}
jmethodID mid = env->GetMethodID(clazz, "<init>","(Ljava/lang/String;Ljava/lang/Throwable;)V");
if (mid == NULL) {
return;
}
printf("Throwing initial exception\n");
env->ThrowNew(clazz, "initial exception");
jthrowable cause = env->ExceptionOccurred();
env->ExceptionClear();
jthrowable e = (jthrowable) env->NewObject(clazz, mid, "second exception", cause);
printf("Throwing second exception: e=0x%08x\n", e);
env->Throw(e);
printf("Leaving native code\n");
}
*** Output ***
$ java -client Test
Throwing initial exception
Throwing second exception: e=0x000e11fc
Leaving native code
Exception in thread "main" #
# HotSpot Virtual Machine Error, Unexpected Signal 10
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
#
# Error ID: 4F533F534F4C415249530E435050079A 01
#
# Problematic Thread: prio=5 tid=0x28030 nid=0x1 runnable
#
Abort
*** backtrace (from gdb) ***
#0 0x77e3c in ?? ()
#1 0x6cbd0 in ?? ()
#2 0x6cbd0 in ?? ()
#3 0x6cbd0 in ?? ()
#4 0x6cb8c in ?? ()
#5 0x6cb8c in ?? ()
#6 0xfe7a499c in __1cMStubRoutinesG_code1_ ()
from /usr/j2se/jre/lib/sparc/client/libjvm.so
#7 0xfe549d44 in __1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethodHandle_pnRJa
vaCallArguments_pnGThread__v_ () from /usr/j2se/jre/lib/sparc/client/libjvm.so
#8 0xfe5493dc in __1cJJavaCallsMcall_virtual6FpnJJavaValue_nLKlassHandle_nMsymb
olHandle_4pnRJavaCallArguments_pnGThread__v_ ()
from /usr/j2se/jre/lib/sparc/client/libjvm.so
#9 0xfe54944c in __1cJJavaCallsMcall_virtual6FpnJJavaValue_nGHandle_nLKlassHand
le_nMsymbolHandle_5pnGThread__v_ ()
from /usr/j2se/jre/lib/sparc/client/libjvm.so
#10 0xfe5509bc in jni_ExceptionDescribe ()
from /usr/j2se/jre/lib/sparc/client/libjvm.so
#11 0x12164 in main ()
(Review ID: 119121)
======================================================================