Author: oheger
Date: Mon Nov 3 13:07:27 2008
New Revision: 710159
URL: http://svn.apache.org/viewvc?rev=710159&view=rev
Log:
CONFIGURATION-346: ConfigurationUtils.convertToHierarchical() now correctly
deals with multi-valued properties.
Modified:
commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationUtils.java
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationUtils.java
commons/proper/configuration/trunk/xdocs/changes.xml
Modified:
commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationUtils.java?rev=710159&r1=710158&r2=710159&view=diff
==============================================================================
---
commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationUtils.java
(original)
+++
commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationUtils.java
Mon Nov 3 13:07:27 2008
@@ -238,7 +238,7 @@
// Workaround for problem with copy()
boolean delimiterParsingStatus = hc.isDelimiterParsingDisabled();
hc.setDelimiterParsingDisabled(true);
- ConfigurationUtils.copy(conf, hc);
+ hc.append(conf);
hc.setDelimiterParsingDisabled(delimiterParsingStatus);
return hc;
}
Modified:
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationUtils.java?rev=710159&r1=710158&r2=710159&view=diff
==============================================================================
---
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationUtils.java
(original)
+++
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationUtils.java
Mon Nov 3 13:07:27 2008
@@ -318,6 +318,21 @@
}
/**
+ * Tests converting a configuration to a hierarchical one that contains a
+ * property with multiple values. This test is related to
CONFIGURATION-346.
+ */
+ public void testConvertToHierarchicalMultiValues()
+ {
+ BaseConfiguration config = new BaseConfiguration();
+ config.addProperty("test", "1,2,3");
+ HierarchicalConfiguration hc = ConfigurationUtils
+ .convertToHierarchical(config);
+ assertEquals("Wrong value 1", 1, hc.getInt("test(0)"));
+ assertEquals("Wrong value 2", 2, hc.getInt("test(1)"));
+ assertEquals("Wrong value 3", 3, hc.getInt("test(2)"));
+ }
+
+ /**
* Tests cloning a configuration that supports this operation.
*/
public void testCloneConfiguration()
Modified: commons/proper/configuration/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/xdocs/changes.xml?rev=710159&r1=710158&r2=710159&view=diff
==============================================================================
--- commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ commons/proper/configuration/trunk/xdocs/changes.xml Mon Nov 3 13:07:27
2008
@@ -23,6 +23,11 @@
<body>
<release version="1.6" date="in SVN" description="">
+ <action dev="oheger" type="fix" issue="CONFIGURATION-346">
+ ConfigurationUtils.convertToHierarchical() now creates multiple
+ configuration nodes for properties with multiple values. This
+ improves compatibility with queries.
+ </action>
<action dev="oheger" type="fix" issue="CONFIGURATION-341">
The "force reload check" mechanism of CombinedConfiguration now also
works with sub configurations created by configurationAt().