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!