commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r657962 - in /commons/proper/configuration/branches/configuration2_experimental: src/main/java/org/apache/commons/configuration2/XMLConfiguration.java src/test/java/org/apache/commons/configuration2/TestXMLConfiguration.java xdocs/changes.xml
Date Mon, 19 May 2008 20:30:56 GMT
Author: oheger
Date: Mon May 19 13:30:55 2008
New Revision: 657962

URL: http://svn.apache.org/viewvc?rev=657962&view=rev
Log:
CONFIGURATION-328: Fixed a bug in XMLConfiguration.addNodes() that prevented attribute nodes
to be added (bug fix from trunk ported to this branch)

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

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java?rev=657962&r1=657961&r2=657962&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
Mon May 19 13:30:55 2008
@@ -878,6 +878,7 @@
 
         XMLNode xmlNode = (XMLNode) createNode(null, node.getName());
         xmlNode.setValue(node.getValue());
+        xmlNode.setAttribute(node.isAttribute());
         for (ConfigurationNode child : node.getChildren())
         {
             xmlNode.addChild(convertToXMLNode(child));

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestXMLConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestXMLConfiguration.java?rev=657962&r1=657961&r2=657962&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestXMLConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestXMLConfiguration.java
Mon May 19 13:30:55 2008
@@ -1365,6 +1365,27 @@
     }
 
     /**
+     * Tests adding an attribute node using the addNodes() method.
+     */
+    public void testAddNodesAttributeNode()
+    {
+        conf.addProperty("testAddNodes.property[@name]", "prop1");
+        conf.addProperty("testAddNodes.property(0).value", "value1");
+        conf.addProperty("testAddNodes.property(-1)[@name]", "prop2");
+        conf.addProperty("testAddNodes.property(1).value", "value2");
+        Collection<ConfigurationNode> nodes = new ArrayList<ConfigurationNode>();
+        nodes.add(new DefaultConfigurationNode("property"));
+        conf.addNodes("testAddNodes", nodes);
+        nodes.clear();
+        ConfigurationNode nd = new DefaultConfigurationNode("name", "prop3");
+        nd.setAttribute(true);
+        nodes.add(nd);
+        conf.addNodes("testAddNodes.property(2)", nodes);
+        assertEquals("Attribute not added", "prop3", conf
+                .getString("testAddNodes.property(2)[@name]"));
+    }
+
+    /**
      * Prepares a configuration object for testing a reload operation.
      *
      * @return the initialized configuration

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=657962&r1=657961&r2=657962&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml (original)
+++ commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml Mon
May 19 13:30:55 2008
@@ -80,6 +80,10 @@
     </release>
 
     <release version="1.6" date="in SVN" description="">
+      <action dev="oheger" type="fix" issue="CONFIGURATION-328">
+        A bug in XMLConfiguration.addNodes() made it impossible to add
+        attribute nodes using this method. This has been fixed.
+      </action>
       <action dev="ebourg" type="fix" issue="CONFIGURATION-322">
         ConfigurationDynaBean now works properly with indexed properties
         stored internally in the underlying configuration as arrays.



Mime
View raw message