You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ro...@apache.org on 2023/03/16 18:02:18 UTC

[axis-axis2-java-core] branch master updated: For ServletFileUpload use, upload.setFileCountMax(1L) . If there is a use case for a larger value, it wasn't obvious. The unit tests pass.

This is an automated email from the ASF dual-hosted git repository.

robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 7840f390ba For ServletFileUpload use, upload.setFileCountMax(1L) . If there is a use case for a larger value, it wasn't obvious. The unit tests pass.
7840f390ba is described below

commit 7840f390badf09dc1abc2cdd2980e2697f5ab318
Author: Robert Lazarski <ro...@gmail.com>
AuthorDate: Thu Mar 16 14:01:47 2023 -0400

    For ServletFileUpload use, upload.setFileCountMax(1L) . If there is a use case for a larger value, it wasn't obvious. The unit tests pass.
---
 .../kernel/src/org/apache/axis2/builder/MultipartFormDataBuilder.java | 3 +++
 .../webapp/src/main/java/org/apache/axis2/webapp/AdminActions.java    | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/modules/kernel/src/org/apache/axis2/builder/MultipartFormDataBuilder.java b/modules/kernel/src/org/apache/axis2/builder/MultipartFormDataBuilder.java
index 99d7389abb..a87cabc24f 100644
--- a/modules/kernel/src/org/apache/axis2/builder/MultipartFormDataBuilder.java
+++ b/modules/kernel/src/org/apache/axis2/builder/MultipartFormDataBuilder.java
@@ -111,6 +111,9 @@ public class MultipartFormDataBuilder implements Builder {
         FileItemFactory factory = new DiskFileItemFactory();
         // Create a new file upload handler
         ServletFileUpload upload = new ServletFileUpload(factory);
+        // There must be a limit. 
+        // This is for contentType="multipart/form-data"
+        upload.setFileCountMax(1L);
         // Parse the request
         return upload.parseRequest(requestContext);
     }
diff --git a/modules/webapp/src/main/java/org/apache/axis2/webapp/AdminActions.java b/modules/webapp/src/main/java/org/apache/axis2/webapp/AdminActions.java
index 9affc3cae8..465b6eef48 100644
--- a/modules/webapp/src/main/java/org/apache/axis2/webapp/AdminActions.java
+++ b/modules/webapp/src/main/java/org/apache/axis2/webapp/AdminActions.java
@@ -155,6 +155,10 @@ final class AdminActions {
                 FileItemFactory factory = new DiskFileItemFactory();
                 //Create a new file upload handler
                 ServletFileUpload upload = new ServletFileUpload(factory);
+                // There must be a limit. This is for an aar file upload,
+                // presumably only one. See:
+                // https://axis.apache.org/axis2/java/core/docs/webadminguide.html#upservice
+                upload.setFileCountMax(1L);
                 List<?> items = upload.parseRequest(req);
                 // Process the uploaded items
                 Iterator<?> iter = items.iterator();