[ 
https://issues.apache.org/jira/browse/CONFIGURATION-540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oliver Heger resolved CONFIGURATION-540.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0

{{MapConfiguration}} now directly uses the passed in {{Properties}} object as 
its data store. Thus, changes on a property done by {{SystemConfiguration}} 
directly affect the corresponding system properties.

Fixed in subversion in revision 1467644. Thanks for the report.
                
> SystemConfiguration copies System.getProperties() instead of directly using 
> it since 1.8
> ----------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-540
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-540
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.8, 1.9
>            Reporter: subes
>            Priority: Critical
>             Fix For: 2.0
>
>
> 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:
> {code}
> public MapConfiguration(Map map) {
>     this.map = map;
> }
> {code}
> In 1.9 this super constructor is used by SystemProperties:
> {code}
> public MapConfiguration(Properties props) {
>     map = convertPropertiesToMap(props);
> }
> {code}
> A fix could look like this:
> {code}
> public SystemConfiguration() {
>     super((Map)System.getProperties());
> }
> {code}
> 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:
> {code}
> new SystemConfiguration();
> {code}
> but instead use:
> {code}
> new MapConfiguration((Map) System.getProperties());
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to