commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "subes (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CONFIGURATION-540) SystemConfiguration copies System.getProperties() instead of directly using it since 1.8
Date Thu, 11 Apr 2013 10:45:24 GMT
subes created CONFIGURATION-540:
-----------------------------------

             Summary: 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.9, 1.8
            Reporter: subes
            Priority: Critical


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:
{quote}
public MapConfiguration(Map map) {
    this.map = map;
}
{quote}

In 1.9 this super constructor is used by SystemProperties:
{quote}
public MapConfiguration(Properties props) {
    map = convertPropertiesToMap(props);
}
{quote}

A fix could look like this:
{quote}
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:
{quote}
new SystemConfiguration();
{quote}
but instead use:
{quote}
new MapConfiguration((Map) System.getProperties());
{quote}

--
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

Mime
View raw message