JDK-6658779 : Regression: HotspotDiagnosticMXBean.getDiagnosticOptions() throws NullPointerException
  • Type: Bug
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Affected Version: 6u10
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris
  • CPU: generic
  • Submitted: 2008-02-04
  • Updated: 2011-03-08
  • Resolved: 2011-03-08
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 6 JDK 7
6u10Fixed 7 b26Fixed
Related Reports
Relates :  
Description
Just call HotSpotDiagnostic.getDiagnosticOptions() and you get the exception below:

java.lang.NullPointerException
	at sun.management.Flag.getVMOption(Flag.java:67)
	at sun.management.HotSpotDiagnostic.getDiagnosticOptions(HotSpotDiagnostic.java:48)
	at GetDiagnosticOptions.checkDiagnosticOptions(GetDiagnosticOptions.java:56)
	at GetDiagnosticOptions.main(GetDiagnosticOptions.java:46)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:623)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:78)
	at java.lang.Thread.run(Thread.java:674)

Works with 6u5 - throws NPE with 6u10 and OpenJDK 7.

Comments
SUGGESTED FIX --- a/src/share/classes/sun/management/Flag.java Sat Dec 01 00:00:00 2007 +0000 +++ b/src/share/classes/sun/management/Flag.java Mon Feb 11 14:24:00 2008 -0800 @@ -64,7 +64,8 @@ class Flag { } VMOption getVMOption() { - return new VMOption(name, value.toString(), writeable, origin); + String val = value == null ? "" : value.toString(); + return new VMOption(name, val, writeable, origin); }
11-02-2008

EVALUATION Some string VM option was changed from an empty string to NULL in HotSpot due to a fix for 6604006. So we need to deal with VM options with null value.
11-02-2008