X
Xiaolei Li
Hi,
I'm running into this peculiar problem where the JVM crashes. My
program uses JNI, specifically JRex [1]. The details are probably too
much to explain here, but it basically uses the Mozilla browser to do
certain things.
Anyway, after I initialize and open the browser through JNI, whenever a
NullPointerException is generated in my Java code (which is separate
from the JRex code), it will cause the entire JVM to crash even when
it's suppose to be caught. For example, the following code snippet will
crash. I've tried some different types of Exceptions to catch (eg,
RuntimeException, Error), but none of them help.
================================================================
public class Dummy { public int item; }
Dummy obj = null;
try {
int temp = obj.item;
}
catch (Exception ex) {
System.err.println("Real null pointer");
}
================================================================
However, if I manually throw a NullPointerException such as below, it
will *not* cause the crash.
================================================================
try {
throw new NullPointerException("Manually thrown null pointer");
}
catch(Exception ex) {
System.err.println(ex.getMessage());
}
================================================================
Can someone give me some directions as to where the possible source of
this might be? Thank you.
[1] http://jrex.mozdev.org/
I'm running into this peculiar problem where the JVM crashes. My
program uses JNI, specifically JRex [1]. The details are probably too
much to explain here, but it basically uses the Mozilla browser to do
certain things.
Anyway, after I initialize and open the browser through JNI, whenever a
NullPointerException is generated in my Java code (which is separate
from the JRex code), it will cause the entire JVM to crash even when
it's suppose to be caught. For example, the following code snippet will
crash. I've tried some different types of Exceptions to catch (eg,
RuntimeException, Error), but none of them help.
================================================================
public class Dummy { public int item; }
Dummy obj = null;
try {
int temp = obj.item;
}
catch (Exception ex) {
System.err.println("Real null pointer");
}
================================================================
However, if I manually throw a NullPointerException such as below, it
will *not* cause the crash.
================================================================
try {
throw new NullPointerException("Manually thrown null pointer");
}
catch(Exception ex) {
System.err.println(ex.getMessage());
}
================================================================
Can someone give me some directions as to where the possible source of
this might be? Thank you.
[1] http://jrex.mozdev.org/