commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r919840 - in /commons/proper/configuration/branches/configuration2_experimental: src/main/java/org/apache/commons/configuration2/INIConfiguration.java src/test/java/org/apache/commons/configuration2/TestINIConfiguration.java xdocs/changes.xml
Date Sat, 06 Mar 2010 20:18:05 GMT
Author: oheger
Date: Sat Mar  6 20:18:04 2010
New Revision: 919840

URL: http://svn.apache.org/viewvc?rev=919840&view=rev
Log:
CONFIGURATION-409: HierarchicalINIConfiguration.save() now works correctly with sections containing
a delimiter character in their name. Ported fix to configuration2 branch.

Modified:
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestINIConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java?rev=919840&r1=919839&r2=919840&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java
Sat Mar  6 20:18:04 2010
@@ -257,15 +257,20 @@
         PrintWriter out = new PrintWriter(writer);
         for (String section : getSections())
         {
+            Configuration subset;
             if (section != null)
             {
                 out.print("[");
                 out.print(section);
                 out.print("]");
                 out.println();
+                subset = createSubnodeConfiguration(getSectionNode(section));
+            }
+            else
+            {
+                subset = getSection(null);
             }
 
-            Configuration subset = getSection(section);
             Iterator<String> keys = subset.getKeys();
             while (keys.hasNext())
             {

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestINIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestINIConfiguration.java?rev=919840&r1=919839&r2=919840&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestINIConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestINIConfiguration.java
Sat Mar  6 20:18:04 2010
@@ -679,4 +679,23 @@
         assertEquals("Wrong value", "one" + LINE_SEPARATOR, config
                 .getString("section5.continueNoLine"));
     }
+
+    /**
+     * Tests whether a configuration can be saved that contains section keys
+     * with delimiter characters. This test is related to CONFIGURATION-409.
+     */
+    public void testSaveKeysWithDelimiters() throws ConfigurationException
+    {
+        INIConfiguration conf = new INIConfiguration();
+        final String section = "Section..with..dots";
+        conf.addProperty(section + ".test1", "test1");
+        conf.addProperty(section + ".test2", "test2");
+        conf.save(TEST_FILE);
+        conf = new INIConfiguration();
+        conf.load(TEST_FILE);
+        assertEquals("Wrong value (1)", "test1", conf.getString(section
+                + ".test1"));
+        assertEquals("Wrong value (2)", "test2", conf.getString(section
+                + ".test2"));
+    }
 }

Modified: commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml?rev=919840&r1=919839&r2=919840&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml (original)
+++ commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml Sat
Mar  6 20:18:04 2010
@@ -79,6 +79,10 @@
     </release>
 
     <release version="1.7" date="in SVN" description="">
+      <action dev="oheger" type="fix" issue="CONFIGURATION-409">
+        HierarchicalINIConfiguration now correctly saves sections whose name
+        contains delimiter characters.
+      </action>
       <action dev="oheger" type="fix" issue="CONFIGURATION-407">
         Fixed a potential IllegalStateException in HierarchicalINIConfiguration
         that can be thrown when the global section is requested concurrently.



Mime
View raw message