Re: Pass a pointer to JNI_GetCreatedJavaVMs() instead of null

2012-05-09 Thread Kumar Srinivasan
On 5/8/2012 1:28 AM, Alan Bateman wrote: On 08/05/2012 04:14, David Holmes wrote: I think it is clear that if there are no VMs then *nVMs is set to zero and JNI_OK is returned. I don't think it is clear and it should be made explicit in the spec. BTW: Did you create a bug for the JNI spec w

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

2012-05-08 Thread Kumar Srinivasan
Hi Alan, David, Vitaly, Ok I will make these changes and push. Thanks Kumar On 07/05/2012 21:21, Kumar Srinivasan wrote: Hi, Please review http://cr.openjdk.java.net/~ksrini/7166955 I think the check needs to be: if (retval < 0 || nVM != 1) (checking if retval == JNI_OK is okay too but

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

2012-05-08 Thread Alan Bateman
On 07/05/2012 21:21, Kumar Srinivasan wrote: Hi, Please review http://cr.openjdk.java.net/~ksrini/7166955 I think the check needs to be: if (retval < 0 || nVM != 1) (checking if retval == JNI_OK is okay too but amounts to the same thing). -Alan

Re: Pass a pointer to JNI_GetCreatedJavaVMs() instead of null

2012-05-08 Thread Alan Bateman
On 08/05/2012 04:14, David Holmes wrote: I think it is clear that if there are no VMs then *nVMs is set to zero and JNI_OK is returned. I don't think it is clear and it should be made explicit in the spec. BTW: Did you create a bug for the JNI spec work? I'll create one if you haven't I jus

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

2012-05-07 Thread David Holmes
Hi Kumar, On 8/05/2012 6:21 AM, Kumar Srinivasan wrote: Hi, Please review http://cr.openjdk.java.net/~ksrini/7166955 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. David - Thanks Kumar

Re: Pass a pointer to JNI_GetCreatedJavaVMs() instead of null

2012-05-07 Thread David Holmes
On 7/05/2012 11:27 PM, Alan Bateman wrote: On 07/05/2012 11:39, David Holmes wrote: 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

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

2012-05-07 Thread Vitaly Davidovich
I agree it doesn't really matter; using JNI_OK is arguably slightly better as it (1) doesn't assume anything about what non negative value it'll assume and (2) uses the constant defined specifically for this, but I agree it's insignificant in the grand scheme of things. Cheers Sent from my phone

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

2012-05-07 Thread Kumar Srinivasan
Hi Vitaly, The JNI Spec says the following: "Returns |JNI_OK| on success; returns a suitable JNI error code (a negative number) on failure." It doesn't really matter, if others feel strongly about it, I will change it. Kumar Hi Kumar, Based on the discussion, should it check for a (re

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

2012-05-07 Thread Vitaly Davidovich
Hi Kumar, Based on the discussion, should it check for a (retval != JNI_OK || vm == null) instead of (retval < 0 || vm == null)? Regards, Vitaly Sent from my phone On May 7, 2012 4:23 PM, "Kumar Srinivasan" wrote: > Hi, > > Please review > > http://cr.openjdk.java.net/~**ksrini/7166955

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

2012-05-07 Thread Kumar Srinivasan
Hi, Please review http://cr.openjdk.java.net/~ksrini/7166955 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 hotspo

Re: Pass a pointer to JNI_GetCreatedJavaVMs() instead of null

2012-05-07 Thread Alan Bateman
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 tak

Re: Pass a pointer to JNI_GetCreatedJavaVMs() instead of null

2012-05-07 Thread Kumar Srinivasan
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 NU

Re: Pass a pointer to JNI_GetCreatedJavaVMs() instead of null

2012-05-07 Thread Alan Bateman
On 07/05/2012 11:39, David Holmes wrote: 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 sa

Re: Pass a pointer to JNI_GetCreatedJavaVMs() instead of null

2012-05-07 Thread David Holmes
On 7/05/2012 7:38 PM, Deven You wrote: Hi All, There is a potential problem in jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp. (Maybe it is not suitable for posting this on core-lib, anyone could tell me which mailing list is prefer?) L85: JNI_GetCreatedJavaVMs(&vm, 1, null) in which

Pass a pointer to JNI_GetCreatedJavaVMs() instead of null

2012-05-07 Thread Deven You
Hi All, There is a potential problem in jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp. (Maybe it is not suitable for posting this on core-lib, anyone could tell me which mailing list is prefer?) L85: JNI_GetCreatedJavaVMs(&vm, 1, null) in which the 3rd parameter is a pointer to