This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.
>
> Andrew.
>

Changing method foo to:

void foo(NullPointer e)
 {
   StringBuffer s = new StringBuffer("hi there");
   char c[] = {'a', 'b', 'c', 'd'};
   s.append(c, 2, 3);
   System.out.println(s);
 };

gives me

LD_LIBRARY_PATH=/opt/gcc-4.1/lib/ ./nullpointer
Exception in thread "main" java.lang.StringIndexOutOfBoundsException
  <<No stacktrace available>>
*** Error code 1

Stop in /home/tsuraan/java/abort.

Which is (I think) more-or-less acceptable.  At least it's not an
abort, even if the stack trace isn't there.

FileChannelImpl.open is private; what method do I need to call to
trigger the open call?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]