commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r902439 - in /commons/proper/configuration/branches/configuration2_experimental/src: main/java/org/apache/commons/configuration2/base/impl/ test/java/org/apache/commons/configuration2/base/impl/
Date Sat, 23 Jan 2010 16:40:23 GMT
Author: oheger
Date: Sat Jan 23 16:40:23 2010
New Revision: 902439

URL: http://svn.apache.org/viewvc?rev=902439&view=rev
Log:
[CONFIGURATION-403] Ported fix for XMLConfiguration.load() to XMLConfigurationSource.

Modified:
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/base/impl/XMLConfigurationSource.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/base/impl/TestXMLConfigurationSource.java

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/base/impl/XMLConfigurationSource.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/base/impl/XMLConfigurationSource.java?rev=902439&r1=902438&r2=902439&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/base/impl/XMLConfigurationSource.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/base/impl/XMLConfigurationSource.java
Sat Jan 23 16:40:23 2010
@@ -766,7 +766,7 @@
         {
             text = text.trim();
         }
-        if (text.length() > 0 || !hasChildren(node))
+        if (text.length() > 0 || (!hasChildren(node) && node != getRootNode()))
         {
             node.setValue(text);
         }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/base/impl/TestXMLConfigurationSource.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/base/impl/TestXMLConfigurationSource.java?rev=902439&r1=902438&r2=902439&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/base/impl/TestXMLConfigurationSource.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/base/impl/TestXMLConfigurationSource.java
Sat Jan 23 16:40:23 2010
@@ -1124,4 +1124,17 @@
         conf = new ConfigurationImpl<ConfigurationNode>(source);
         assertTrue("Not empty", conf.isEmpty());
     }
+
+    /**
+     * Tests whether an empty configuration that was saved and reloaded is still
+     * considered empty.
+     */
+    @Test
+    public void testIsEmptyAfterReload() throws ConfigurationException
+    {
+        source.clear();
+        assertTrue("Not empty", conf.isEmpty());
+        Configuration<ConfigurationNode> conf2 = reload();
+        assertTrue("Not empty after reload", conf2.isEmpty());
+    }
 }



Mime
View raw message