JDK-8022854 : System.setProperties(null) does not remove implementation properties
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 8
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2013-08-12
  • Updated: 2018-09-11
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.
Other
tbdUnresolved
Related Reports
Blocks :  
Blocks :  
Blocks :  
Blocks :  
Description
When the system properties are initialized in System.initializeSystemClass() the set of properties is trimmed to remove certain implementation properties. If the system properties are re-initialized via System.setProperties(null) then the implementation properties are not removed. Additionally, the property values set by sun.misc.Version.init() are omitted.
Comments
blocked by incorrect reinitializations
14-07-2014

None of the visible properties are of concern. They are private only because they are implementation properties.
10-09-2013

I want to make sure we are satisfied that there are no vulnerabilities before going public.
04-09-2013

Adds JTReg test
04-09-2013

Nice test. If you want to turn it into a jtreg test, I'd suggest not using assert, and instead writing an if-statement with a throw of AssertionError or something. Unfortunately it's optional whether assertions are enabled. It should probably be written to use /othervm mode since it resets system properties. Come to think of it, it might not work under jtreg, since jtreg adds some items to system properties. Not sure if they'll survive a properties reset.
14-08-2013

public class SystemPropertiesReinit { public static void main(String... args) { Properties first = System.getProperties(); System.setProperties(null); Properties second = System.getProperties(); Properties diff1 = (Properties) first.clone(); Properties diff2 = (Properties) second.clone(); diff1.keySet().removeAll(second.keySet()); diff2.keySet().removeAll(first.keySet()); System.out.println("Appearing in second: " + diff2 ); System.out.println("Missing from second: " + diff1 ); assert diff1.isEmpty() && diff2.isEmpty() : "Not empty"; } } Produces: Appearing in second: {sun.nio.MaxDirectMemorySize=-1} Missing from second: {java.runtime.name=Java(TM) SE Runtime Environment, java.runtime.version=1.7.0_25-b15} Exception in thread "main" java.lang.AssertionError: Not empty at junktest.SystemPropertiesReinit.main(SystemPropertiesReinit.java:31)
13-08-2013

Default value for sun.nio.MaxDirectMemorySize should re-examined.
12-08-2013