Pass a pointer to JNI_GetCreatedJavaVMs() instead of null / review please

David Holmes david.holmes at
Tue May 8 03:06:52 UTC 2012

Hi Kumar,

On 8/05/2012 6:21 AM, Kumar Srinivasan wrote:
> Hi,
> Please review

Thanks for jumping on checking the return value. Actually hotspot can 
never return an error here so it was much less of an issue than I thought.


> Thanks
> Kumar
>> On 07/05/2012 16:45, Kumar Srinivasan wrote:
>>> 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.
>> I think HotSpot can only ever return JNI_OK so it may only be a
>> potential issue when running with another VM.
>> -Alan

More information about the core-libs-dev mailing list