United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6658779 Regression: HotspotDiagnosticMXBean.getDiagnosticOptions() throws NullPointerException
JDK-6658779 : Regression: HotspotDiagnosticMXBean.getDiagnosticOptions() throws NullPointerException

Details
Type:
Bug
Submit Date:
2008-02-04
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
core-svc
OS:
solaris
Sub-Component:
java.lang.management
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
6u10
Fixed Versions:

Related Reports
Backport:
Relates:

Sub Tasks

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);
     }
                                     
2008-02-11
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.
                                     
2008-02-11



Hardware and Software, Engineered to Work Together