commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r578579 - 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 Sun, 23 Sep 2007 16:20:25 GMT
Author: oheger
Date: Sun Sep 23 09:20:24 2007
New Revision: 578579

URL: http://svn.apache.org/viewvc?rev=578579&view=rev
Log:
CONFIGURATION-296: The root node of a XMLConfiguration is now properly initialized with a
reference to the XML document's root element

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=578579&r1=578578&r2=578579&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
Sun Sep 23 09:20:24 2007
@@ -419,7 +419,12 @@
             setPublicID(document.getDoctype().getPublicId());
             setSystemID(document.getDoctype().getSystemId());
         }
+
         constructHierarchy(getRoot(), document.getDocumentElement(), elemRefs);
+        if (elemRefs)
+        {
+            getRoot().setReference(document.getDocumentElement());
+        }
     }
 
     /**
@@ -1242,7 +1247,7 @@
          *
          * @param node the affected node
          * @param name the name of the attribute
-         * @param listDelimiter the delimiter vor attributes with multiple values
+         * @param listDelimiter the delimiter for attributes with multiple values
          */
         static void updateAttribute(Node node, String name, char listDelimiter)
         {

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=578579&r1=578578&r2=578579&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
Sun Sep 23 09:20:24 2007
@@ -301,6 +301,24 @@
         checkSavedConfig(checkConf);
         assertTrue("Attribute not found after save", checkConf
                 .containsKey("[@test]"));
+        checkConf.setProperty("[@test]", "newValue");
+        checkConf.save();
+        conf = checkConf;
+        checkConf = new XMLConfiguration();
+        checkConf.setFile(testSaveConf);
+        checkSavedConfig(checkConf);
+        assertEquals("Attribute not modified after save", "newValue", checkConf
+                .getString("[@test]"));
+    }
+
+    /**
+     * Tests whether the configuration's root node is initialized with a
+     * reference to the corresponding XML element.
+     */
+    public void testGetRootReference()
+    {
+        assertNotNull("Root node has no reference", conf.getRootNode()
+                .getReference());
     }
 
     public void testAddList()

Modified: commons/proper/configuration/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/xdocs/changes.xml?rev=578579&r1=578578&r2=578579&view=diff
==============================================================================
--- commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ commons/proper/configuration/trunk/xdocs/changes.xml Sun Sep 23 09:20:24 2007
@@ -23,6 +23,10 @@
 
   <body>
     <release version="1.5-SNAPSHOT" date="in SVN" description="">
+      <action dev="oheger" type="fix" issue="CONFIGURATION-296">
+        A bug in XMLConfiguration caused that attributes of the root element
+        could not be changed. This has been fixed.
+      </action>
       <action dev="oheger" type="add" issue="CONFIGURATION-290">
         A new method registerEntityId() was added to XMLConfiguration, which
         allows to register URLs for entities. A new default implementation of



Mime
View raw message