commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r712405 - in /commons/proper/configuration/trunk: src/java/org/apache/commons/configuration/AbstractHierarchicalFileConfiguration.java src/test/org/apache/commons/configuration/TestXMLConfiguration.java xdocs/changes.xml
Date Sat, 08 Nov 2008 16:37:49 GMT
Author: oheger
Date: Sat Nov  8 08:37:48 2008
New Revision: 712405

URL: http://svn.apache.org/viewvc?rev=712405&view=rev
Log:
CONFIGURATION-348: AbstractHierarchicalFileConfiguration now overrides getKeys() to perform
a reload check.

Modified:
    commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/AbstractHierarchicalFileConfiguration.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/AbstractHierarchicalFileConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/AbstractHierarchicalFileConfiguration.java?rev=712405&r1=712404&r2=712405&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/AbstractHierarchicalFileConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/AbstractHierarchicalFileConfiguration.java
Sat Nov  8 08:37:48 2008
@@ -17,11 +17,11 @@
 
 package org.apache.commons.configuration;
 
-import java.io.Reader;
-import java.io.Writer;
 import java.io.File;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
 import java.net.URL;
 import java.util.Collection;
 import java.util.Iterator;
@@ -308,6 +308,12 @@
         return super.containsKey(key);
     }
 
+    public Iterator getKeys()
+    {
+        reload();
+        return super.getKeys();
+    }
+
     public Iterator getKeys(String prefix)
     {
         reload();

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=712405&r1=712404&r2=712405&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
Sat Nov  8 08:37:48 2008
@@ -964,6 +964,26 @@
     }
 
     /**
+     * Tests whether reloads are recognized when querying the configuration's
+     * keys.
+     */
+    public void testGetKeysWithReload() throws ConfigurationException
+    {
+        XMLConfiguration c = setUpReloadTest();
+        conf.addProperty("aNewKey", "aNewValue");
+        conf.save(testSaveConf);
+        boolean found = false;
+        for (Iterator it = c.getKeys(); it.hasNext();)
+        {
+            if ("aNewKey".equals(it.next()))
+            {
+                found = true;
+            }
+        }
+        assertTrue("Reload not performed", found);
+    }
+
+    /**
      * Tests accessing properties when the XPATH expression engine is set.
      */
     public void testXPathExpressionEngine()

Modified: commons/proper/configuration/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/xdocs/changes.xml?rev=712405&r1=712404&r2=712405&view=diff
==============================================================================
--- commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ commons/proper/configuration/trunk/xdocs/changes.xml Sat Nov  8 08:37:48 2008
@@ -23,6 +23,10 @@
 
   <body>
     <release version="1.6" date="in SVN" description="">
+      <action dev="oheger" type="fix" issue="CONFIGURATION-348">
+        AbstractHierarchicalFileConfiguration.getKeys() now also checks whether
+        a reload is required.
+      </action>
       <action dev="oheger" type="fix" issue="CONFIGURATION-347">
         AbstractFileConfiguration.getKeys() now returns an iterator that points
         to a snapshot of the keys of the configuration. This prevents



Mime
View raw message