RFR(XS): 8048050: Agent NullPointerException when rmi.port in use
    Sergey Gabdurakhmanov 
    sergey.gabdurakhmanov at oracle.com
       
    Fri Nov 14 13:07:41 UTC 2014
    
    
  
Hi,
Could I please have a review of this small fix.
webrev: http://cr.openjdk.java.net/~sgabdura/8048050/webrev.00/
bug: https://bugs.openjdk.java.net/browse/JDK-8048050
Problem description:
If the com.sun.management.jmxremote.rmi.port option is provided it will 
give a NPE if already in use by a different JVM. Its expected to fail 
but should provide an appropriate exception.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run two instances in different JVMs at same time with the following 
options:
-Dcom.sun.management.jmxremote.port=2222 
-Dcom.sun.management.jmxremote.rmi.port=2223 
-Dcom.sun.management.jmxremote.authenticate=false
Root cause:
Then we trying to start JMXConnectorServer (see method exportMBeanServer 
of class sun.management.jmxremote.ConnectorBootstrap on already used 
port it cause IOException. Call of connServer.getAddress().toString() in 
the exception handler cause NullPointerException because 
connServer.getAddress() returns null.
Solution:
Provide url.toString() if connServer.getAddress() is null
I'm going to push this fix into JDK9, 8 and 7.
BR,
Sergey
    
    
More information about the hotspot-runtime-dev
mailing list