You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2008/04/17 05:33:42 UTC

svn commit: r648944 - in /cocoon/branches/BRANCH_2_1_X: src/java/org/apache/cocoon/servlet/multipart/MultipartParser.java status.xml

Author: joerg
Date: Wed Apr 16 20:33:42 2008
New Revision: 648944

URL: http://svn.apache.org/viewvc?rev=648944&view=rev
Log:
fix inconsistencies between inline parts and file parts when multiple fields of the same name exist (http://marc.info/?l=xml-cocoon-dev&m=120835513330316&w=4)

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/MultipartParser.java
    cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/MultipartParser.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/MultipartParser.java?rev=648944&r1=648943&r2=648944&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/MultipartParser.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/MultipartParser.java Wed Apr 16 20:33:42 2008
@@ -324,14 +324,21 @@
             if ( out!=null ) out.close();
         }
 
-        String name = (String)headers.get("name");
+        String field = (String)headers.get("name");
+        Vector v = (Vector) this.parts.get(field);
+
+        if (v == null) {
+            v = new Vector();
+            this.parts.put(field, v);
+        }
+
         if (oversized) {
-            this.parts.put(name, new RejectedPart(headers, length, this.contentLength, this.maxUploadSize));
+            v.add(new RejectedPart(headers, length, this.contentLength, this.maxUploadSize));
         } else if (file == null) {
             byte[] bytes = ((ByteArrayOutputStream) out).toByteArray();
-            this.parts.put(name, new PartInMemory(headers, bytes));
+            v.add(new PartInMemory(headers, bytes));
         } else {
-            this.parts.put(name, new PartOnDisk(headers, file));
+            v.add(new PartOnDisk(headers, file));
         }
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?rev=648944&r1=648943&r2=648944&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Wed Apr 16 20:33:42 2008
@@ -182,11 +182,16 @@
 
   <changes>
   <release version="2.1.12" date="TBD">
+    <action dev="JH" type="add">
+      Core: Allow multiple file uploads of the same field name. If there are multiple file uploads Request.get(String)
+      will return a Vector. If there is only one file upload it will return the Part as it did before. This is now the
+      same behavior as for inline parts.
+    </action>
     <action dev="AG" type="update">
       Core: Update commons-lang to 2.4.
     </action>
     <action dev="AG" type="fix" fixes-bug="COCOON-2186">
-      Forms: Suggest list .. initial value not being displayed.
+      Forms: Fix suggest list for which the initial value was not displayed.
     </action>
     <action dev="JH" type="fix">
       Core: Fix synchronization issues in ContinuationsManager implementation.