Message ID | CABc96T_dL8gN9LwtE+Gb_WuzAv1XvCaU+rbZkxhNb-Wb=EdBJw@mail.gmail.com |
---|---|
State | New |
Headers | show |
>>>>> "Jie" == Jie Liu <lj8175@gmail.com> writes:
Jie> RTEMS does not have virtual memory management, so there is no error
Jie> when access the 0 address on rtems.
Jie> So 'str->length()' donot throw NPE and just return an meaningless value.
If you compile the Java parts of the library with -fcheck-references, it
should work. This is something you have to set up as part of the port,
as it is decided at (libgcj-) configure time.
This won't help with the native code. IIRC in the end we just gave up
on that; if you wanted real correctness you would have to add a null
check at every dereference in the C++ code. I believe Andrew had a g++
patch to do this in the compiler, but it was rejected.
Tom
=========== The first mail, for adding Joel =========== Hi, When I use gcj on an RTOS(RTEMS), Double.parseDouble(null) throw NumberFormatException, but it should throw NullPointerException. So I add the patch below: Index: natVMDouble.cc =================================================================== --- natVMDouble.cc (revision 172224) +++ natVMDouble.cc (working copy) @@ -19,6 +19,7 @@ #include <java/lang/VMDouble.h> #include <java/lang/Character.h> #include <java/lang/NumberFormatException.h> +#include <java/lang/NullPointerException.h> #include <jvm.h> #include <stdio.h> @@ -162,6 +163,9 @@ jdouble java::lang::VMDouble::parseDouble(jstring str) { + if(str == NULL) + throw new NullPointerException(); + int length = str->length(); while (length > 0