commons-issues mailing list archives

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

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

subes updated CONFIGURATION-540:
--------------------------------

    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:
{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}

  was:
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:
{code}
new SystemConfiguration();
{code}
but instead use:
{quote}
new MapConfiguration((Map) System.getProperties());
{quote}

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

Mime
View raw message