commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject svn commit: r171380 - in /jakarta/commons/proper/collections/trunk: RELEASE-NOTES.html project.xml src/java/org/apache/commons/collections/ExtendedProperties.java src/test/org/apache/commons/collections/TestExtendedProperties.java
Date Sun, 22 May 2005 23:04:46 GMT
Author: scolebourne
Date: Sun May 22 16:04:44 2005
New Revision: 171380

URL: http://svn.apache.org/viewcvs?rev=171380&view=rev
Log:
Fix ExtendedProperties.convertProperties to pickup any default parent configuration
bug 32204, from Shinobu Kawai

Modified:
    jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html
    jakarta/commons/proper/collections/trunk/project.xml
    jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
    jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java

Modified: jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html?rev=171380&r1=171379&r2=171380&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html (original)
+++ jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html Sun May 22 16:04:44 2005
@@ -73,6 +73,7 @@
 <li>BoundedFifoBuffer/CircularFifoBuffer - Fix serialization to work in case where
buffer serialized when full [31433]</li>
 <li>BoundedFifoBuffer - Fix iterator remove bug causing ArrayIndexOutOfBounds error
[33071]</li>
 <li>IteratorChain.remove() - Fix to avoid IllegalStateException when one of the underlying
iterators is a FilterIterator [34267]</li>
+<li>ExtendedProperties.convertProperties() - Fix to handle default properties maps
correctly [32204]</li>
 </ul>
 
 <center><h3>JAVADOC</h3></center>

Modified: jakarta/commons/proper/collections/trunk/project.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/project.xml?rev=171380&r1=171379&r2=171380&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/project.xml (original)
+++ jakarta/commons/proper/collections/trunk/project.xml Sun May 22 16:04:44 2005
@@ -207,6 +207,9 @@
       <name>Nissim Karpenstein</name>
     </contributor>
     <contributor>
+      <name>Shinobu Kawai</name>
+    </contributor>
+    <contributor>
       <name>Mohan Kishore</name>
     </contributor>
     <contributor>

Modified: jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java?rev=171380&r1=171379&r2=171380&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
(original)
+++ jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
Sun May 22 16:04:44 2005
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2004 The Apache Software Foundation
+ *  Copyright 2001-2005 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -137,6 +137,7 @@
  * @author Janek Bogucki
  * @author Mohan Kishore
  * @author Stephen Colebourne
+ * @author Shinobu Kawai
  */
 public class ExtendedProperties extends Hashtable {
     
@@ -1610,6 +1611,9 @@
 
     /**
      * Convert a standard properties class into a configuration class.
+     * <p>
+     * NOTE: From Commons Collections 3.2 this method will pick up
+     * any default parent Properties of the specified input object.
      *
      * @param props  the properties object to convert
      * @return new ExtendedProperties created from props
@@ -1617,12 +1621,12 @@
     public static ExtendedProperties convertProperties(Properties props) {
         ExtendedProperties c = new ExtendedProperties();
 
-        for (Enumeration e = props.keys(); e.hasMoreElements();) {
+        for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {
             String s = (String) e.nextElement();
             c.setProperty(s, props.getProperty(s));
         }
 
         return c;
     }
-    
+
 }

Modified: jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java?rev=171380&r1=171379&r2=171380&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java
(original)
+++ jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestExtendedProperties.java
Sun May 22 16:04:44 2005
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2004 The Apache Software Foundation
+ *  Copyright 2001-2005 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.util.Properties;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -31,6 +32,7 @@
  * @author Geir Magnusson Jr.
  * @author Mohan Kishore
  * @author Stephen Colebourne
+ * @author Shinobu Kawai
  */
 public class TestExtendedProperties extends TestCase {
     
@@ -251,5 +253,18 @@
         assertEquals("c", ep1.getVector("one").get(2));
         assertEquals("d", ep1.getVector("one").get(3));
     }
-    
+
+    public void testInheritDefaultProperties() {
+        Properties defaults = new Properties();
+        defaults.setProperty("resource.loader", "class");
+
+        Properties properties = new Properties(defaults);
+        properties.setProperty("test", "foo");
+
+        ExtendedProperties extended = ExtendedProperties.convertProperties(properties);
+
+        assertEquals("foo", extended.getString("test"));
+        assertEquals("class", extended.getString("resource.loader"));
+    }
+
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message