commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r919796 - in /commons/proper/configuration/trunk: src/java/org/apache/commons/configuration/HierarchicalINIConfiguration.java src/test/org/apache/commons/configuration/TestHierarchicalINIConfiguration.java xdocs/changes.xml
Date Sat, 06 Mar 2010 16:35:52 GMT
Author: oheger
Date: Sat Mar  6 16:35:52 2010
New Revision: 919796

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

Modified:
    commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalINIConfiguration.java
    commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestHierarchicalINIConfiguration.java
    commons/proper/configuration/trunk/xdocs/changes.xml

Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalINIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalINIConfiguration.java?rev=919796&r1=919795&r2=919796&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalINIConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalINIConfiguration.java
Sat Mar  6 16:35:52 2010
@@ -269,15 +269,20 @@
         while (it.hasNext())
         {
             String section = (String) it.next();
+            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 keys = subset.getKeys();
             while (keys.hasNext())
             {

Modified: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestHierarchicalINIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestHierarchicalINIConfiguration.java?rev=919796&r1=919795&r2=919796&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestHierarchicalINIConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestHierarchicalINIConfiguration.java
Sat Mar  6 16:35:52 2010
@@ -631,6 +631,23 @@
     }
 
     /**
+     * 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
+    {
+        HierarchicalINIConfiguration conf = new HierarchicalINIConfiguration();
+        final String section = "Section..with..dots";
+        conf.addProperty(section + ".test1", "test1");
+        conf.addProperty(section + ".test2", "test2");
+        conf.save(TEST_FILE);
+        conf = new HierarchicalINIConfiguration();
+        conf.load(TEST_FILE);
+        assertEquals("Wrong value (1)", "test1", conf.getString(section + ".test1"));
+        assertEquals("Wrong value (2)", "test2", conf.getString(section + ".test2"));
+    }
+
+    /**
      * A thread class for testing concurrent access to the global section.
      */
     private static class GlobalSectionTestThread extends Thread

Modified: commons/proper/configuration/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/xdocs/changes.xml?rev=919796&r1=919795&r2=919796&view=diff
==============================================================================
--- commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ commons/proper/configuration/trunk/xdocs/changes.xml Sat Mar  6 16:35:52 2010
@@ -23,6 +23,10 @@
 
   <body>
     <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