commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r513498 - in /jakarta/commons/proper/configuration/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/configuration/XMLConfiguration.java src/test/org/apache/commons/configuration/TestXMLConfiguration.java xdocs/changes.xml
Date Thu, 01 Mar 2007 23:25:34 GMT
Author: oheger
Date: Thu Mar  1 13:15:07 2007
New Revision: 513498

URL: http://svn.apache.org/viewvc?view=rev&rev=513498
Log:
CONFIGURATION-254: Fix for XMLConfiguration.clone(); thanks to Carsten Kaiser

Modified:
    jakarta/commons/proper/configuration/trunk/RELEASE-NOTES.txt
    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/XMLConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
    jakarta/commons/proper/configuration/trunk/xdocs/changes.xml

Modified: jakarta/commons/proper/configuration/trunk/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/RELEASE-NOTES.txt?view=diff&rev=513498&r1=513497&r2=513498
==============================================================================
--- jakarta/commons/proper/configuration/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/configuration/trunk/RELEASE-NOTES.txt Thu Mar  1 13:15:07 2007
@@ -85,6 +85,12 @@
   that on Unix under certain circumstances absolute file names are interpreted
   as relative ones.
 
+* [CONFIGURATION-254]
+  After cloning a XMLConfiguration there was still a connection to the original
+  configuration. So when the clone was modified and then saved the content of
+  the original configuration was written. This has now been fixed.
+
+
 IMPROVEMENTS IN 1.4
 ===================
 * [CONFIGURATION-155]

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/XMLConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/XMLConfiguration.java?view=diff&rev=513498&r1=513497&r2=513498
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/XMLConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/XMLConfiguration.java
Thu Mar  1 13:15:07 2007
@@ -710,7 +710,7 @@
 
         // clear document related properties
         copy.document = null;
-        copy.setDelegate(createDelegate());
+        copy.setDelegate(copy.createDelegate());
         // clear all references in the nodes, too
         clearReferences(copy.getRootNode());
 

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java?view=diff&rev=513498&r1=513497&r2=513498
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
Thu Mar  1 13:15:07 2007
@@ -670,6 +670,23 @@
     }
 
     /**
+     * Tests saving a configuration after cloning to ensure that the clone and
+     * the original are completely detachted.
+     */
+    public void testCloneWithSave() throws ConfigurationException
+    {
+        XMLConfiguration c = (XMLConfiguration) conf.clone();
+        c.addProperty("test.newProperty", Boolean.TRUE);
+        conf.addProperty("test.orgProperty", Boolean.TRUE);
+        c.save(testSaveConf);
+        XMLConfiguration c2 = new XMLConfiguration(testSaveConf);
+        assertTrue("New property after clone() was not saved", c2
+                .getBoolean("test.newProperty"));
+        assertFalse("Property of original config was saved", c2
+                .containsKey("test.orgProperty"));
+    }
+
+    /**
      * Tests the subset() method. There was a bug that calling subset() had
      * undesired side effects.
      */

Modified: jakarta/commons/proper/configuration/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/xdocs/changes.xml?view=diff&rev=513498&r1=513497&r2=513498
==============================================================================
--- jakarta/commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/configuration/trunk/xdocs/changes.xml Thu Mar  1 13:15:07 2007
@@ -23,6 +23,12 @@
 
   <body>
     <release version="1.4-SNAPSHOT" date="in SVN">
+      <action dev="oheger" type="update" issue="CONFIGURATION-254" due-to="Carsten Kaiser">
+        After cloning a XMLConfiguration there was still a connection to the
+        original configuration. So when the clone was modified and then saved
+        the content of the original configuration was written. This has now
+        been fixed.
+      </action>
       <action dev="oheger" type="update">
         Class loading in BeanHelper is now done using ClassUtils of Commons
         Lang.



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message