commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r1185672 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/ main/java/org/apache/commons/configuration/plist/ main/java/org/apache/commons/configuration/web/ test/java/org/apache/commons/configuration/...
Date Tue, 18 Oct 2011 14:08:51 GMT
Author: ebourg
Date: Tue Oct 18 14:08:51 2011
New Revision: 1185672

URL: http://svn.apache.org/viewvc?rev=1185672&view=rev
Log:
Reduced the dependency on Commons Collections and Commons Lang when a replacement exists in
the JDK

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DatabaseConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalINIConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/INIConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/JNDIConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfigurationLayout.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertyConverter.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListParser.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListParser.jj
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/AppletConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletContextConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestBaseConfiguration.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/web/TestServletRequestConfiguration.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseConfiguration.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseConfiguration.java
Tue Oct 18 14:08:51 2011
@@ -20,11 +20,10 @@ package org.apache.commons.configuration
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.collections.map.LinkedMap;
-
 /**
  * Basic configuration class. Stores the configuration data but does not
  * provide any load or save functions. If you want to load your Configuration
@@ -52,7 +51,7 @@ import org.apache.commons.collections.ma
 public class BaseConfiguration extends AbstractConfiguration implements Cloneable
 {
     /** stores the configuration key-value pairs */
-    private Map store = new LinkedMap();
+    private Map store = new LinkedHashMap();
 
     /**
      * Adds a key/value pair to the map.  This routine does no magic morphing.

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DatabaseConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DatabaseConfiguration.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DatabaseConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DatabaseConfiguration.java
Tue Oct 18 14:08:51 2011
@@ -26,10 +26,8 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
-
 import javax.sql.DataSource;
 
-import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.logging.LogFactory;
 
 /**
@@ -246,7 +244,10 @@ public class DatabaseConfiguration exten
                 else
                 {
                     // Split value if it containts the list delimiter
-                    CollectionUtils.addAll(results, PropertyConverter.toIterator(value, getListDelimiter()));
+                    Iterator it = PropertyConverter.toIterator(value, getListDelimiter());
+                    while (it.hasNext()) {
+                        results.add(it.next());
+                    }
                 }
             }
 

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java
Tue Oct 18 14:08:51 2011
@@ -20,14 +20,14 @@ package org.apache.commons.configuration
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 import java.util.Stack;
 
-import org.apache.commons.collections.iterators.SingletonIterator;
-import org.apache.commons.collections.set.ListOrderedSet;
 import org.apache.commons.configuration.event.ConfigurationEvent;
 import org.apache.commons.configuration.event.ConfigurationListener;
 import org.apache.commons.configuration.tree.ConfigurationNode;
@@ -747,7 +747,7 @@ public class HierarchicalConfiguration e
         }
         else
         {
-            itValues = new SingletonIterator(value);
+            itValues = Collections.singleton(value).iterator();
         }
 
         while (itNodes.hasNext() && itValues.hasNext())
@@ -1521,7 +1521,7 @@ public class HierarchicalConfiguration e
          */
         public DefinedKeysVisitor()
         {
-            keyList = new ListOrderedSet();
+            keyList = new LinkedHashSet();
             parentKeys = new Stack();
         }
 

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalINIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalINIConfiguration.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalINIConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalINIConfiguration.java
Tue Oct 18 14:08:51 2011
@@ -25,13 +25,12 @@ import java.io.Writer;
 import java.net.URL;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.commons.collections.set.ListOrderedSet;
 import org.apache.commons.configuration.tree.ConfigurationNode;
 import org.apache.commons.configuration.tree.ViewNode;
-import org.apache.commons.lang.StringUtils;
 
 /**
  * <p>
@@ -665,7 +664,7 @@ public class HierarchicalINIConfiguratio
 
         if (quoted)
         {
-            return '"' + StringUtils.replace(value, "\"", "\\\"") + '"';
+            return '"' + value.replaceAll("\"", "\\\\\\\"") + '"';
         }
         else
         {
@@ -713,7 +712,7 @@ public class HierarchicalINIConfiguratio
      */
     public Set getSections()
     {
-        Set sections = new ListOrderedSet();
+        Set sections = new LinkedHashSet();
         boolean globalSection = false;
         boolean inSection = false;
 

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/INIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/INIConfiguration.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/INIConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/INIConfiguration.java
Tue Oct 18 14:08:51 2011
@@ -29,8 +29,6 @@ import java.util.Iterator;
 import java.util.Set;
 import java.util.TreeSet;
 
-import org.apache.commons.lang.StringUtils;
-
 /**
  * <p>
  * An initialization or ini file is a configuration file typically found on
@@ -428,7 +426,7 @@ public class INIConfiguration extends Ab
 
         if (quoted)
         {
-            return '"' + StringUtils.replace(value, "\"", "\\\"") + '"';
+            return '"' + value.replaceAll("\"", "\\\\\\\"") + '"';
         }
         else
         {

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/JNDIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/JNDIConfiguration.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/JNDIConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/JNDIConfiguration.java
Tue Oct 18 14:08:51 2011
@@ -349,7 +349,7 @@ public class JNDIConfiguration extends A
         {
             return false;
         }
-        key = StringUtils.replace(key, ".", "/");
+        key = key.replaceAll("\\.", "/");
         try
         {
             // throws a NamingException if JNDI doesn't contain the key.
@@ -405,7 +405,7 @@ public class JNDIConfiguration extends A
 
         try
         {
-            key = StringUtils.replace(key, ".", "/");
+            key = key.replaceAll("\\.", "/");
             return getBaseContext().lookup(key);
         }
         catch (NameNotFoundException e)

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfigurationLayout.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfigurationLayout.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfigurationLayout.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfigurationLayout.java
Tue Oct 18 14:08:51 2011
@@ -20,11 +20,11 @@ import java.io.IOException;
 import java.io.Reader;
 import java.io.Writer;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.collections.map.LinkedMap;
 import org.apache.commons.configuration.event.ConfigurationEvent;
 import org.apache.commons.configuration.event.ConfigurationListener;
 import org.apache.commons.lang.StringUtils;
@@ -172,7 +172,7 @@ public class PropertiesConfigurationLayo
                     "Configuration must not be null!");
         }
         configuration = config;
-        layoutData = new LinkedMap();
+        layoutData = new LinkedHashMap();
         config.addConfigurationListener(this);
 
         if (c != null)

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertyConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertyConverter.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertyConverter.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertyConverter.java
Tue Oct 18 14:08:51 2011
@@ -33,6 +33,7 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
@@ -40,7 +41,6 @@ import java.util.Locale;
 
 import org.apache.commons.collections.IteratorUtils;
 import org.apache.commons.collections.iterators.IteratorChain;
-import org.apache.commons.collections.iterators.SingletonIterator;
 import org.apache.commons.lang.BooleanUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.SystemUtils;
@@ -939,7 +939,7 @@ public final class PropertyConverter
     {
         if (value == null)
         {
-            return IteratorUtils.emptyIterator();
+            return Collections.EMPTY_SET.iterator();
         }
         if (value instanceof String)
         {
@@ -950,7 +950,7 @@ public final class PropertyConverter
             }
             else
             {
-                return new SingletonIterator(value);
+                return Collections.singleton(value).iterator();
             }
         }
         else if (value instanceof Collection)
@@ -973,7 +973,7 @@ public final class PropertyConverter
         }
         else
         {
-            return new SingletonIterator(value);
+            return Collections.singleton(value).iterator();
         }
     }
 

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java
Tue Oct 18 14:08:51 2011
@@ -413,7 +413,7 @@ public class PropertyListConfiguration e
                 || s.indexOf(',') != -1
                 || s.indexOf(';') != -1)
         {
-            s = StringUtils.replace(s, "\"", "\\\"");
+            s = s.replaceAll("\"", "\\\\\\\"");
             s = "\"" + s + "\"";
         }
 

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListParser.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListParser.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListParser.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListParser.java
Tue Oct 18 14:08:51 2011
@@ -8,8 +8,8 @@ import java.util.ArrayList;
 import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.configuration.HierarchicalConfiguration.Node;
 
-import org.apache.commons.lang.StringUtils;
 import org.apache.commons.codec.binary.Hex;
+import org.apache.commons.lang.StringUtils;
 
 /**
  * JavaCC based parser for the PropertyList format.
@@ -39,7 +39,7 @@ class PropertyListParser implements Prop
 
     protected String unescapeQuotes(String s)
     {
-        return StringUtils.replace(s, "\\\"", "\"");
+        return s.replaceAll("\\\\\"", "\"");
     }
 
     /**
@@ -60,7 +60,7 @@ class PropertyListParser implements Prop
         }
 
         // remove the white spaces
-        s = StringUtils.replaceChars(s, " \t\n\r", "");
+        s = s.replaceAll("\\s", "");
 
         // add a leading 0 to ensure well formed bytes
         if (s.length() % 2 != 0)

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListParser.jj
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListParser.jj?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListParser.jj
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListParser.jj
Tue Oct 18 14:08:51 2011
@@ -31,7 +31,6 @@ import java.util.ArrayList;
 import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.configuration.HierarchicalConfiguration.Node;
 
-import org.apache.commons.lang.StringUtils;
 import org.apache.commons.codec.binary.Hex;
 
 /**
@@ -62,7 +61,7 @@ class PropertyListParser {
 
     protected String unescapeQuotes(String s)
     {
-        return StringUtils.replace(s, "\\\"", "\"");
+        return s.replaceAll("\\\\\"", "\"");
     }
 
     /**
@@ -83,7 +82,7 @@ class PropertyListParser {
         }
 
         // remove the white spaces
-        s = StringUtils.replaceChars(s, " \t\n\r", "");
+        s = s.replaceAll("\\s", "");
 
         // add a leading 0 to ensure well formed bytes
         if (s.length() % 2 != 0)

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/AppletConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/AppletConfiguration.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/AppletConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/AppletConfiguration.java
Tue Oct 18 14:08:51 2011
@@ -18,10 +18,9 @@
 package org.apache.commons.configuration.web;
 
 import java.applet.Applet;
+import java.util.Arrays;
 import java.util.Iterator;
 
-import org.apache.commons.collections.iterators.ArrayIterator;
-
 /**
  * A configuration wrapper to read applet parameters. This configuration is
  * read only, adding or removing a property will throw an
@@ -61,6 +60,6 @@ public class AppletConfiguration extends
             keys[i] = paramsInfo[i][0];
         }
 
-        return new ArrayIterator(keys);
+        return Arrays.asList(keys).iterator();
     }
 }

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletConfiguration.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletConfiguration.java
Tue Oct 18 14:08:51 2011
@@ -17,12 +17,11 @@
 
 package org.apache.commons.configuration.web;
 
+import java.util.Collections;
 import java.util.Iterator;
 import javax.servlet.Servlet;
 import javax.servlet.ServletConfig;
 
-import org.apache.commons.collections.iterators.EnumerationIterator;
-
 /**
  * A configuration wrapper around a {@link ServletConfig}. This configuration
  * is read only, adding or removing a property will throw an
@@ -65,6 +64,6 @@ public class ServletConfiguration extend
 
     public Iterator getKeys()
     {
-        return new EnumerationIterator(config.getInitParameterNames());
+        return Collections.list(config.getInitParameterNames()).iterator();
     }
 }

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletContextConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletContextConfiguration.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletContextConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletContextConfiguration.java
Tue Oct 18 14:08:51 2011
@@ -17,12 +17,11 @@
 
 package org.apache.commons.configuration.web;
 
+import java.util.Collections;
 import java.util.Iterator;
 import javax.servlet.Servlet;
 import javax.servlet.ServletContext;
 
-import org.apache.commons.collections.iterators.EnumerationIterator;
-
 /**
  * A configuration wrapper to read the initialization parameters of a servlet
  * context. This configuration is read only, adding or removing a property will
@@ -66,6 +65,6 @@ public class ServletContextConfiguration
 
     public Iterator getKeys()
     {
-        return new EnumerationIterator(context.getInitParameterNames());
+        return Collections.list(context.getInitParameterNames()).iterator();
     }
 }

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java
Tue Oct 18 14:08:51 2011
@@ -17,11 +17,10 @@
 
 package org.apache.commons.configuration.web;
 
+import java.util.Collections;
 import java.util.Iterator;
 import javax.servlet.FilterConfig;
 
-import org.apache.commons.collections.iterators.EnumerationIterator;
-
 /**
  * A configuration wrapper around a {@link FilterConfig}. This configuration is
  * read only, adding or removing a property will throw an
@@ -53,6 +52,6 @@ public class ServletFilterConfiguration 
 
     public Iterator getKeys()
     {
-        return new EnumerationIterator(config.getInitParameterNames());
+        return Collections.list(config.getInitParameterNames()).iterator();
     }
 }

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
Tue Oct 18 14:08:51 2011
@@ -24,8 +24,6 @@ import java.util.List;
 
 import javax.servlet.ServletRequest;
 
-import org.apache.commons.collections.iterators.EnumerationIterator;
-
 /**
  * A configuration wrapper to read the parameters of a servlet request. This
  * configuration is read only, adding or removing a property will throw an
@@ -84,6 +82,6 @@ public class ServletRequestConfiguration
 
     public Iterator getKeys()
     {
-        return new EnumerationIterator(request.getParameterNames());
+        return request.getParameterMap().keySet().iterator();
     }
 }

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestBaseConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestBaseConfiguration.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestBaseConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestBaseConfiguration.java
Tue Oct 18 14:08:51 2011
@@ -22,6 +22,7 @@ import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.NoSuchElementException;
 import java.util.Properties;
@@ -31,8 +32,6 @@ import java.util.StringTokenizer;
 import junit.framework.TestCase;
 import junitx.framework.ListAssert;
 import junitx.framework.ObjectAssert;
-
-import org.apache.commons.collections.set.ListOrderedSet;
 import org.apache.commons.configuration.event.ConfigurationEvent;
 import org.apache.commons.configuration.event.ConfigurationListener;
 
@@ -723,7 +722,7 @@ public class TestBaseConfiguration exten
         assertEquals("first element of the 'list' property", "foo", config.resolveContainerStore("list"));
 
         // set of objects
-        Set set = new ListOrderedSet();
+        Set set = new LinkedHashSet();
         set.add("foo");
         set.add("bar");
         config.addPropertyDirect("set", set);

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/web/TestServletRequestConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/web/TestServletRequestConfiguration.java?rev=1185672&r1=1185671&r2=1185672&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/web/TestServletRequestConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/web/TestServletRequestConfiguration.java
Tue Oct 18 14:08:51 2011
@@ -17,18 +17,17 @@
 
 package org.apache.commons.configuration.web;
 
-import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.List;
-
+import java.util.Map;
 import javax.servlet.ServletRequest;
 
 import com.mockobjects.servlet.MockHttpServletRequest;
-import org.apache.commons.collections.iterators.IteratorEnumeration;
 import org.apache.commons.configuration.AbstractConfiguration;
 import org.apache.commons.configuration.BaseConfiguration;
 import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationMap;
 import org.apache.commons.configuration.TestAbstractConfiguration;
-import org.apache.commons.lang.StringUtils;
 
 /**
  * Test case for the {@link ServletRequestConfiguration} class.
@@ -62,9 +61,9 @@ public class TestServletRequestConfigura
                 return null;
             }
 
-            public Enumeration getParameterNames()
+            public Map getParameterMap()
             {
-                return new IteratorEnumeration(configuration.getKeys());
+                return new HashMap();
             }
         };
 
@@ -78,8 +77,7 @@ public class TestServletRequestConfigura
      * @param base the configuration with the underlying values
      * @return the servlet request configuration
      */
-    private ServletRequestConfiguration createConfiguration(
-            final Configuration base)
+    private ServletRequestConfiguration createConfiguration(final Configuration base)
     {
         ServletRequest request = new MockHttpServletRequest()
         {
@@ -88,9 +86,9 @@ public class TestServletRequestConfigura
                 return base.getStringArray(key);
             }
 
-            public Enumeration getParameterNames()
+            public Map getParameterMap()
             {
-                return new IteratorEnumeration(base.getKeys());
+                return new ConfigurationMap(base);
             }
         };
 
@@ -128,22 +126,23 @@ public class TestServletRequestConfigura
      */
     public void testListWithEscapedElements()
     {
-        String[] values =
-        { "test1", "test2\\,test3", "test4\\,test5" };
-        final String listKey = "test.list";
+        String[] values = { "test1", "test2\\,test3", "test4\\,test5" };
+        String listKey = "test.list";
+        
         BaseConfiguration config = new BaseConfiguration();
         config.setListDelimiter('\0');
         config.addProperty(listKey, values);
-        assertEquals("Wrong number of list elements", values.length, config
-                .getList(listKey).size());
+        
+        assertEquals("Wrong number of list elements", values.length, config.getList(listKey).size());
+        
         Configuration c = createConfiguration(config);
         List v = c.getList(listKey);
-        assertEquals("Wrong number of elements in list", values.length, v
-                .size());
+        
+        assertEquals("Wrong number of elements in list", values.length, v.size());
+        
         for (int i = 0; i < values.length; i++)
         {
-            assertEquals("Wrong value at index " + i, StringUtils.replace(
-                    values[i], "\\", StringUtils.EMPTY), v.get(i));
+            assertEquals("Wrong value at index " + i, values[i].replaceAll("\\\\", ""), v.get(i));
         }
     }
 }



Mime
View raw message