commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r710200 - in /commons/proper/collections/trunk/src: java/org/apache/commons/collections/ExtendedProperties.java test/org/apache/commons/collections/TestExtendedProperties.java
Date Mon, 03 Nov 2008 22:41:10 GMT
Author: bayard
Date: Mon Nov  3 14:41:09 2008
New Revision: 710200

URL: http://svn.apache.org/viewvc?rev=710200&view=rev
Log:
Applying Nathan Bubna's patch from COLLECTIONS-271 to fix the bug introduced in the last patch
where getKeys() breaks after a combine() or subset() call. 

Modified:
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
    commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java?rev=710200&r1=710199&r2=710200&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
Mon Nov  3 14:41:09 2008
@@ -820,7 +820,8 @@
     public void combine(ExtendedProperties props) {
         for (Iterator it = props.getKeys(); it.hasNext();) {
             String key = (String) it.next();
-            super.put(key, props.get(key));
+            clearProperty(key);
+            addPropertyDirect(key, props.get(key));
         }
     }
     

Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java?rev=710200&r1=710199&r2=710200&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java
(original)
+++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java
Mon Nov  3 14:41:09 2008
@@ -405,6 +405,15 @@
         ExtendedProperties props2 = new ExtendedProperties();
         props2.combine(props);
         assertEquals( "\\\\192.168.1.91\\test", props2.getProperty("test") );
+
+        ExtendedProperties props3 = new ExtendedProperties();
+        props3.setProperty("sub.test", "foo");
+        props2.combine(props3);
+        assertEquals("foo", props2.getProperty("sub.test"));
+
+        ExtendedProperties subs = props2.subset("sub");
+        assertNotNull(subs);
+        assertEquals("foo", subs.getProperty("test"));
     }
 
     public void testCollections238() throws IOException {



Mime
View raw message