commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1573347 - in /commons/proper/configuration/branches/immutableNodes/src: main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java
Date Sun, 02 Mar 2014 19:51:48 GMT
Author: oheger
Date: Sun Mar  2 19:51:47 2014
New Revision: 1573347

URL: http://svn.apache.org/r1573347
Log:
BaseHierarchicalConfiguration now supports cloning correctly.

cloneNodeModel() was implemented to create a copy of the node model using the
same node as root node.

Modified:
    commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java
    commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java

Modified: commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java?rev=1573347&r1=1573346&r2=1573347&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java
Sun Mar  2 19:51:47 2014
@@ -623,10 +623,16 @@ public class BaseHierarchicalConfigurati
         return null;
     }
 
+    /**
+     * {@inheritDoc} This implementation creates a new instance of
+     * {@link InMemoryNodeModel}, initialized with this configuration's root
+     * node. This has the effect that although the same nodes are used, the
+     * original and copied configurations are independent on each other.
+     */
     @Override
-    protected NodeModel<ImmutableNode> cloneNodeModel() {
-        //TODO implementation
-        return null;
+    protected NodeModel<ImmutableNode> cloneNodeModel()
+    {
+        return new InMemoryNodeModel(getRootNode());
     }
 
     /**

Modified: commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java?rev=1573347&r1=1573346&r2=1573347&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java
Sun Mar  2 19:51:47 2014
@@ -322,6 +322,7 @@ public class TestHierarchicalConfigurati
     {
         Configuration copy = (Configuration) config.clone();
         assertTrue(copy instanceof BaseHierarchicalConfiguration);
+        config.setProperty("tables.table(0).name", "changed table name");
         checkContent(copy);
     }
 



Mime
View raw message