Review request for 6858708: HotspotDiagnosticMXBean.setVMOption() throws NullPointerException

Mandy Chung Mandy.Chung at Sun.COM
Fri Nov 13 09:26:23 PST 2009


Tomas,

The fix looks good.  Thanks for fixing it.

I'll file a RFE to rewrite sun.management.Flag to support different types.

Thanks
Mandy

Tomas Hurka wrote:
> Hi All,
>
> The NullPointerException is thrown only if the setVMOption() is 
> invoked for HeapDumpPath VM option. Due to CR 6604006, default value 
> for HeapDumpPath flag is now null (instead of an empty string) and 
> therefor flag.getValue() in HotSpotDiagnostic.setVMOption() now 
> returns null. This causes that the type of flag is not recognized and 
> error-reporting code in setVMOption() throws NPE.
>
> Webrev at:
>    http://cr.openjdk.java.net/~thurka/6858708/webrev.01/
>
> The fix is simple - convert null to empty string in the 
> sun.management.Flag constructor. This way type of the flag is 
> recognized as String. I also added test.
> In general it is not very nice that sun.management.Flag uses value of 
> the flag to detect its type so maybe whole code should be rewritten to 
> explicitly specify type of the flag.
>
> Thanks,
> -- 
> Tomas Hurka   <mailto:tomas.hurka at sun.com>
> NetBeans Profiler http://profiler.netbeans.org
> VisualVM http://visualvm.dev.java.net
> Software Engineer, Developer Platforms Group
> Sun Microsystems, Praha Czech Republic
>



More information about the serviceability-dev mailing list