stack overflow & null pointer exceptions

Andrew Haley aph@pasanda.cygnus.co.uk
Wed Apr 21 09:17:00 GMT 1999


> From: Godmar Back <gback@cs.utah.edu>
> Date: Wed, 21 Apr 1999 10:09:16 -0600 (MDT)
> 
> Andrew, did you try the test program I sent?

Yes.

> I updated and tried it on a Linux 2.2.5/glibc2.0.7 RH 5.2 box, and it 
> still doesn't quite seem to work.
> 
> Here it is again:

<snip>

> When run with the .java frontend, I see:
> 
> gback@peerless [24](/tmp) > gcj --main=NullPointerTest NullPointerTest.java
> gback@peerless [25](/tmp) > ./a.out
> Perfectnull
> ° ... lots of garbage ...

I think that we have a problem with try ... finally in Java source
files.  I'm looking into it.

> When compiling the .class file only, I see:
> 
> gback@peerless [26](/tmp) > javac NullPointerTest.java 
> gback@peerless [27](/tmp) > gcj --main=NullPointerTest NullPointerTest.class 
> gback@peerless [28](/tmp) > ./a.out
> This is Perfect
> ° ... lots of garbage ...

I don't see any of the garbage when compiling from .class, just 
"This is Perfect".  I've absolutely no idea why this happens to 
you.

Try replacing

  String x = yuck.toLowerCase();

with

  throw new NullPointerException();

and tell me what happens.

Andrew.


More information about the Java mailing list