This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: [re] Java executables can abort trying to access a null pointer in a leaf function
> The longer I look at this, the more bizarre it is.
>
> I'm wondering if maybe _Jv_ThrowNullPointerException either has no
> unwind info or its unwind info is not found. That would do it.
>
> Maybe no methods in libgcj can throw exceptions. Try
>
> StringBuffer.append(char[] data, int offset, int count) with something
> out of bounds. See if you can catch that.
>
> If that works, see if something like native code
> FileChannelImpl.open (String, int) can throw a FileNotFoundException.
Actually, I guess that the StringBuffer.append really isn't working.
If my code looks like:
public class NullPointer
{
private int i = 5;
private static int j = 10;
public static void main(String[] args)
{
try
{
new NullPointer().foo(null);
}
catch (NullPointerException x)
{
System.out.println("Caught an exception!");
System.out.println(x);
}
}
void foo(NullPointer e)
{
StringBuffer sb = new StringBuffer("hello there");
char c[] = {'a', 'b', 'c', 'd'};
sb.append(c, 2, 3);
System.out.println(sb);
};
}
I never do see the "Caught an exception!" message. I had thought the
exeption in thread main was the print of x, but I guess it isn't.