You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2007/09/23 18:20:25 UTC
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
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