I'm still testing this.

This patch adds a JCL_ThrowExceptionNoMessage function, which invokes the void constructor of the given class,

There are also a couple of issues in general in jcl.c. One is that in JCL_ThrowException, we throw a ClassNotFoundException if the specified exception class can't be found. There are two issues:

1. We don't return after throwing that exception, meaning we'll continue on and call ThrowNew again with a NULL class argument.

2. ClassNotFoundException is a checked exception, but very likely the native method we are in does not declare that it throws this. Could this be trouble brewing?

Also, in JCL_malloc and JCL_realloc we throw OutOfMemoryExceptions if the native calls return NULL. It doesn't seem like this will work (though, if there is an explanation of why it will always work, I'll listen), so I've also modified this to allocate a static OutOfMemoryException on load, and these methods now throw that instance.

2007-02-02  Casey Marshall  <[EMAIL PROTECTED]>

        * native/jni/classpath/jcl.c (OOM_obj): new static variable.
        (JNI_OnLoad): initialize `OOM_obj'.
        (JCL_ThrowException): return after throwing class not found
        exception.
        (JCL_ThrowExceptionNoMessage): new function.
        (JCL_malloc, JCL_realloc): throw `OOM_obj'.
        * native/jni/classpath/jni.h: include assert.h.
        (JCL_ThrowExceptionNoMessage): new function.
        * native/jni/java-nio/gnu_java_nio_VMChannel.c
        (Java_gnu_java_nio_VMChannel_read__ILjava_nio_ByteBuffer_2):
        don't throw NonReadableChannelException with a message.
        (Java_gnu_java_nio_VMChannel_readScattering): likewise.
        (Java_gnu_java_nio_VMChannel_writeGathering): don't throw
        NonWritableChannelException with a message.

Attachment: jcl-excep.patch
Description: Binary data

Reply via email to