commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r657961 - in /commons/proper/configuration/trunk: src/java/org/apache/commons/configuration/XMLConfiguration.java src/test/org/apache/commons/configuration/TestXMLConfiguration.java xdocs/changes.xml
Date Mon, 19 May 2008 20:28:22 GMT
Author: oheger
Date: Mon May 19 13:28:21 2008
New Revision: 657961

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

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

Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/XMLConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/XMLConfiguration.java?rev=657961&r1=657960&r2=657961&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/XMLConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/XMLConfiguration.java
Mon May 19 13:28:21 2008
@@ -869,6 +869,7 @@
 
         XMLNode nd = (XMLNode) createNode(node.getName());
         nd.setValue(node.getValue());
+        nd.setAttribute(node.isAttribute());
         for (Iterator it = node.getChildren().iterator(); it.hasNext();)
         {
             nd.addChild(convertToXMLNode((ConfigurationNode) it.next()));

Modified: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java?rev=657961&r1=657960&r2=657961&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
Mon May 19 13:28:21 2008
@@ -1365,6 +1365,28 @@
     }
 
     /**
+     * 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 nodes = new ArrayList();
+        nodes.add(new HierarchicalConfiguration.Node("property"));
+        conf.addNodes("testAddNodes", nodes);
+        nodes.clear();
+        ConfigurationNode nd = new HierarchicalConfiguration.Node("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/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/xdocs/changes.xml?rev=657961&r1=657960&r2=657961&view=diff
==============================================================================
--- commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ commons/proper/configuration/trunk/xdocs/changes.xml Mon May 19 13:28:21 2008
@@ -23,6 +23,10 @@
 
   <body>
     <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