JNI bug?

Marco Trudel mtrudel@gmx.ch
Thu Feb 1 12:02:00 GMT 2007


David Daney wrote:
> Marco Trudel wrote:
>>
>>
>> But the question remains: What to do about this? I have no idea where to
>> look for this problem or what to do against. I would like to have the
>> same behavior, but it's not worth it if it's a huge thing to implement...
>>
> Perhaps in jni.cc in the function array_from_valist().  You could try 
> something like this:

The function array_from_valist() is never called in my minimal example. 
I checked with a printf() and with gdb. As far as I can see, only
- _Jv_JNI_Init
- _Jv_LookupJNIMethod
are ever called from jni.cc.

Any other ideas where to look? I don't know where happens what when 
calling a method over jni.


> for (int i = 0; i < arg_types->length; ++i)
> {
>    values[i].j = 0; // Clean garbage out of the union so that buggy JNI 
> code looking for jint where it should be looking for jboolean will work.

I think it's not that easy. It should be correctly set after the 
boolean. If b then 1 else 0. So the suggested malloc from Tom also won't 
work...


thanks
Marco

> .
> .
> .
> 
> Note that I have not tested the code so I have no idea if it would work  
> I don't even think we should do something like this, but it might work 
> for you in a pinch.
> 
> David Daney
> 



More information about the Java mailing list