commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joerg Wesely (Created) (JIRA)" <>
Subject [jira] [Created] (CONFIGURATION-471) CompositeConfiguration delivers value from wrong child
Date Thu, 10 Nov 2011 09:14:52 GMT
CompositeConfiguration delivers value from wrong child

                 Key: CONFIGURATION-471
             Project: Commons Configuration
          Issue Type: Bug
          Components: File reloading
    Affects Versions: 1.7
            Reporter: Joerg Wesely

I create a composite configuration with two PropertyConfigurations: a user configuration and
a default configuration, with the userConfiguration as inMemoryConfiguration.
If both configurations contain the same key, the value from defaultConfiguration is returned
although the user configuration was added first. If no inMemoryConfiguration is specified,
it's working ok:

Configuration defaultConf = new PropertiesConfiguration();
defaultConf.addProperty("prop1", "fromDefaultConfig");
Configuration userConf = new PropertiesConfiguration();
userConf.addProperty("prop1", "fromUserConfig");
CompositeConfiguration noMemoryConfig = new CompositeConfiguration();
System.out.println("noMemoryConfig: " + noMemoryConfig.getString("prop1")); // Shows "fromUserConfig"

CompositeConfiguration withMemoryConfig = new CompositeConfiguration(userConf);
System.out.println("withMemoryConfig: " + withMemoryConfig.getString("prop1")); // Shows "fromDefaultConfig"

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message