Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
1.8, 1.9
-
None
-
None
Description
In commons-configuration-1.7 the SystemConfiguration directly used the Map of System.getProperties(). Thus when changing the properties inside the SystemConfiguration, the changes were visible in the Map of System.getProperties().
Since commons-configuration-1.8 the SystemConfiguration creates a new Map as a copy of System.getProperties() and thus changes in the SystemConfiguration Map are not visible in the System.getProperties() Map.
In 1.7 this super constructor is used by SystemProperties:
public MapConfiguration(Map map) { this.map = map; }
In 1.9 this super constructor is used by SystemProperties:
public MapConfiguration(Properties props) {
map = convertPropertiesToMap(props);
}
A fix could look like this:
public SystemConfiguration() { super((Map)System.getProperties()); }
This breaks the functionality I expected to be able to use SystemConfiguration as a replacement API for accessing and manipulating SystemProperties. For me this is a regression.
My workaround is currently not to use:
new SystemConfiguration();
but instead use:
new MapConfiguration((Map) System.getProperties());
Attachments
Issue Links
- duplicates
-
CONFIGURATION-581 SystemConfiguration can not get the correct system property
- Closed