JDK-7167126 : JNI_GetCreatedJavaVMs spec not clear on whether nVMs can be NULL, also behavior when no VM running
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2012-05-08
  • Updated: 2014-04-03
  • Resolved: 2014-04-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Relates :  
Description
The specification for JNI_GetCreatedJavaVMs does not make it clear whether the nVMs parameter can be passed as NULL. HotSpot allows it to be NULL, apparently J9 does not. As HotSpot (and possibly other VMs) allow the parameter be NULL then it would be compatibility issue to disallow it now (could break eixsting code). Although the spec should make it clear that NULL is allowed, it should also include a warning that passing NULL should be discouraged as otherwise the user of the function has no way to know if JavaVM* is valid or not.

In addition JNI_GetCreatedJavaVMs is not completely clear how it should behave when there isn't a VM running. Developers may wonder if it will return JNI_ERR or some other error, or whether it will return JNI_OK with *nVMs set to 0.

More information can be found in this thread on OpenJDK:

http://mail.openjdk.java.net/pipermail/core-libs-dev/2012-May/010133.html

Comments
May be revisiting this API in a future release.
04-06-2013

We should clarify the doc to specify the current hotspot behavior so as to not break any existing applications.
12-02-2013