Pass a pointer to JNI_GetCreatedJavaVMs() instead of null

Kumar Srinivasan kumar.x.srinivasan at oracle.COM
Mon May 7 15:45:27 UTC 2012


Hi David, Deven, Alan,
> The spec doesn't say anything but the implementation does check for 
> NULL. I think this is a spec issue rather than a code issue (and I 
> think hotspot-runtime owns the JNI spec so cc'ed). It is common 
> practice for API's that take pointers like this to say "if buf is not 
> NULL then the value of XXX is written into buf". Particularly as in 
> this case there will only ever be at most 1 VM created per-process 
> anyway.
>
> I'm more concerned about the fact that the code doesn't even check if 
> JNI_GetCreatedVMs returns successfully!

Ouch!, I will file a CR and fix this.

Kumar

>
> David
> -----
>
>> I think it is more reasonable to change null to an integer variable.
>> Here is my fix[2]
>>
>> [1]
>> http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#wp633 
>>
>>
>>
>> [2] http://cr.openjdk.java.net/~littlee/ojdk-432/webrev.00/
>> <http://cr.openjdk.java.net/%7Elittlee/ojdk-432/webrev.00/>
>>
>>
>> Please review this mail!
>>
>> Thanks a lot!
>>




More information about the core-libs-dev mailing list