Author: markt
Date: Tue Sep 24 13:22:49 2013
New Revision: 1525881

URL: http://svn.apache.org/r1525881
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55576
Preserve the order that request parameters were presented by the client.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ParameterMap.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/Parameters.java
    tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestParameters.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1525696

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ParameterMap.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ParameterMap.java?rev=1525881&r1=1525880&r2=1525881&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ParameterMap.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ParameterMap.java Tue 
Sep 24 13:22:49 2013
@@ -14,17 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.catalina.util;
 
-
-import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
 
 import org.apache.tomcat.util.res.StringManager;
 
-
 /**
  * Extended implementation of <strong>HashMap</strong> that includes a
  * <code>locked</code> property.  This class can be used to safely expose
@@ -35,8 +31,7 @@ import org.apache.tomcat.util.res.String
  * @author Craig R. McClanahan
  * @version $Id$
  */
-
-public final class ParameterMap<K,V> extends HashMap<K,V> {
+public final class ParameterMap<K,V> extends LinkedHashMap<K,V> {
 
     private static final long serialVersionUID = 1L;
 

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/Parameters.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/Parameters.java?rev=1525881&r1=1525880&r2=1525881&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/Parameters.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/Parameters.java Tue 
Sep 24 13:22:49 2013
@@ -22,7 +22,7 @@ import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Enumeration;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
 
 import org.apache.tomcat.util.buf.B2CConverter;
@@ -49,8 +49,8 @@ public final class Parameters {
     protected static final StringManager sm =
         StringManager.getManager("org.apache.tomcat.util.http");
 
-    private final HashMap<String,ArrayList<String>> paramHashValues =
-        new HashMap<String,ArrayList<String>>();
+    private final Map<String,ArrayList<String>> paramHashValues =
+            new LinkedHashMap<String,ArrayList<String>>();
 
     private boolean didQueryParameters=false;
 

Modified: 
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestParameters.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestParameters.java?rev=1525881&r1=1525880&r2=1525881&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestParameters.java 
(original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestParameters.java 
Tue Sep 24 13:22:49 2013
@@ -207,8 +207,8 @@ public class TestParameters {
 
         names = p.getParameterNames();
         assertTrue(names.hasMoreElements());
-        assertEquals("foo2", names.nextElement());
         assertEquals("foo1", names.nextElement());
+        assertEquals("foo2", names.nextElement());
         assertFalse(names.hasMoreElements());
 
         values = p.getParameterValues("foo1");
@@ -231,8 +231,8 @@ public class TestParameters {
         // Check current parameters remain unaffected
         names = p.getParameterNames();
         assertTrue(names.hasMoreElements());
-        assertEquals("foo2", names.nextElement());
         assertEquals("foo1", names.nextElement());
+        assertEquals("foo2", names.nextElement());
         assertFalse(names.hasMoreElements());
 
         values = p.getParameterValues("foo1");

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1525881&r1=1525880&r2=1525881&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Sep 24 13:22:49 2013
@@ -56,6 +56,14 @@
   issues to not "pop up" wrt. others).
 -->
 <section name="Tomcat 7.0.45 (violetagg)">
+  <subsection name="Catalina">
+    <changelog>
+      <add>
+        <bug>55576</bug>: Preserve the order in which request parameters were
+        received when accessing them via the Servlet API. (markt)
+      </add>
+    </changelog>
+  </subsection>
   <subsection name="Cluster">
     <changelog>
       <fix>
@@ -68,9 +76,11 @@
 <section name="Tomcat 7.0.44 (violetagg)">
   <subsection name="Jasper">
     <changelog>
-      <bug>55582</bug>: Correct concurrency issue that can result in two
-      instances of JspServletWrapper being created for one tag Patch provided 
by
-      Sheldon Shao. (markt)
+      <fix>
+        <bug>55582</bug>: Correct concurrency issue that can result in two
+        instances of JspServletWrapper being created for one tag Patch provided
+        by Sheldon Shao. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to