JDK-6260131 : sun.management.RuntimeImpl's SystemProperties attribute gives partial results
  • Type: Bug
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Affected Version: 5.0u2
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-04-22
  • Updated: 2010-04-02
  • Resolved: 2005-09-17
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
6 b53Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
It appears that Properties.keys() is used instead of Properties.propertyNames() in the implementation of sun.management.RuntimeImpl's SystemProperties attribute. It only shows the properties from the given Properties instance itself.  This leads to partial results when one does

  Properties  myProps = new Properties( System.getProperties() );
  myProps.load(...);
  System.setProperties( myProps );

Worse, these partial results never include the original system properties!

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See above.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would expect that Properties.propertyNames() and Properties.getProperty() would be used to produce comprehensive results inclusive of any/all nested/default Properties objects.
ACTUAL -
The actual result in the example above is that only the properties from the 'myProp' level are included.

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
None -- other than to write your own replacement MBean...
###@###.### 2005-04-22 17:48:22 GMT

Comments
SUGGESTED FIX Attached webrev.tar
07-09-2005

EVALUATION RuntimeMXBean.getSystemProperties() should return the entire set of system properties. Will fix this in Mustang. ###@###.### 2005-05-11 16:00:06 GMT The current implementation of Properties.propertyNames() assumes all keys are of String type. That may need to be fixed as part of this bug fix. ###@###.### 2005-05-11 16:25:15 GMT
11-05-2005