Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > NullPointerException causing JVM to crash

Reply
Thread Tools

NullPointerException causing JVM to crash

 
 
Xiaolei Li
Guest
Posts: n/a
 
      04-26-2005
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/

--
Xiaolei Li | http://www.velocityreviews.com/forums/(E-Mail Removed) | www.xiaolei.org
 
Reply With Quote
 
 
 
 
Chris Smith
Guest
Posts: n/a
 
      04-26-2005
Xiaolei Li <(E-Mail Removed)> wrote:
> 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.


My guess is that something in the browser is installing a signal handler
for SIGSEGV, and this is interfering with the JVM's mechanism to catch
and handle NullPointerException. Can you prevent Mozilla from
installing signal handlers somehow?

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
Reply With Quote
 
 
 
 
Gordon Beaton
Guest
Posts: n/a
 
      04-26-2005
On Tue, 26 Apr 2005 20:43:21 +0000 (UTC), Xiaolei Li wrote:
> I'm running into this peculiar problem where the JVM crashes. My
> program uses JNI, specifically JRex [1].


[...]

> Can someone give me some directions as to where the possible source
> of this might be?


My guess: your native code.

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
nullpointerexception from within JVM asd Java 2 06-23-2005 01:52 PM
73 megabyte NullPointerException objects out of memory'ing our JVM C B Java 3 08-12-2004 04:06 AM
Re: Handling both MS JVM and Sun JVM Kevin Hooke Java 2 09-02-2003 05:31 AM
LinkedList NullPointerException occurs after switched from IBM JVM 1.4.0 to 1.4.1 Tohru Kao Java 3 07-14-2003 08:12 AM
LinkedList NullPointerException occurs after switched from IBM JVM 1.4.0 to 1.4.1 Tohru Kao Java 1 07-08-2003 09:09 AM



Advertisments