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

ggregory pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/commons-fileupload.git

commit b247774a72a044f5d5380ae947140ee80af4e78b
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Jun 5 07:49:12 2025 -0400

    Sort members
---
 .../apache/commons/fileupload/FileUploadBase.java  | 42 ++++++-------
 .../commons/fileupload/MultipartStreamTest.java    | 64 +++++++++----------
 .../org/apache/commons/fileupload/SizesTest.java   | 72 +++++++++++-----------
 3 files changed, 89 insertions(+), 89 deletions(-)

diff --git a/src/main/java/org/apache/commons/fileupload/FileUploadBase.java 
b/src/main/java/org/apache/commons/fileupload/FileUploadBase.java
index 4b19d75d..9448ead0 100644
--- a/src/main/java/org/apache/commons/fileupload/FileUploadBase.java
+++ b/src/main/java/org/apache/commons/fileupload/FileUploadBase.java
@@ -56,16 +56,6 @@ import org.apache.commons.io.IOUtils;
  */
 public abstract class FileUploadBase {
 
-    /**
-     * Line feed.
-     */
-    private static final char LF = '\n';
-
-    /**
-     * Carriage return.
-     */
-    private static final char CR = '\r';
-
     /**
      * The iterator, which is returned by
      * {@link FileUploadBase#getItemIterator(RequestContext)}.
@@ -785,6 +775,16 @@ public abstract class FileUploadBase {
 
     }
 
+    /**
+     * Line feed.
+     */
+    private static final char LF = '\n';
+
+    /**
+     * Carriage return.
+     */
+    private static final char CR = '\r';
+
     /**
      * HTTP content type header name.
      */
@@ -1142,17 +1142,6 @@ public abstract class FileUploadBase {
         }
     }
 
-    /**
-     * Obtain the per part size limit for headers.
-     *
-     * @return The maximum size of the headers for a single part in bytes.
-     *
-     * @since 1.6.0
-     */
-    public int getPartHeaderSizeMax() {
-        return partHeaderSizeMax;
-    }
-
     /**
      * <p> Parses the {@code header-part} and returns as key/value
      * pairs.
@@ -1198,6 +1187,17 @@ public abstract class FileUploadBase {
         return headers;
     }
 
+    /**
+     * Obtain the per part size limit for headers.
+     *
+     * @return The maximum size of the headers for a single part in bytes.
+     *
+     * @since 1.6.0
+     */
+    public int getPartHeaderSizeMax() {
+        return partHeaderSizeMax;
+    }
+
     /**
      * Returns the progress listener.
      *
diff --git 
a/src/test/java/org/apache/commons/fileupload/MultipartStreamTest.java 
b/src/test/java/org/apache/commons/fileupload/MultipartStreamTest.java
index 257c55c9..79533c24 100644
--- a/src/test/java/org/apache/commons/fileupload/MultipartStreamTest.java
+++ b/src/test/java/org/apache/commons/fileupload/MultipartStreamTest.java
@@ -37,38 +37,6 @@ public class MultipartStreamTest {
 
     static private final String BOUNDARY_TEXT = "myboundary";
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testSmallBuffer() throws Exception {
-        final String strData = "foobar";
-        final byte[] contents = strData.getBytes();
-        final InputStream input = new ByteArrayInputStream(contents);
-        final byte[] boundary = BOUNDARY_TEXT.getBytes();
-        final int iBufSize = 1;
-        @SuppressWarnings("unused")
-        final MultipartStream unused = new MultipartStream(input, boundary, 
iBufSize, new MultipartStream.ProgressNotifier(null, contents.length));
-    }
-
-    @Test
-    public void testThreeParamConstructor() throws Exception {
-        final String strData = "foobar";
-        final byte[] contents = strData.getBytes();
-        final InputStream input = new ByteArrayInputStream(contents);
-        final byte[] boundary = BOUNDARY_TEXT.getBytes();
-        final int iBufSize = boundary.length + 
MultipartStream.BOUNDARY_PREFIX.length + 1;
-        final MultipartStream ms = new MultipartStream(input, boundary, 
iBufSize, new MultipartStream.ProgressNotifier(null, contents.length));
-        assertNotNull(ms);
-    }
-
-    @Test
-    public void testTwoParamConstructor() throws Exception {
-        final String strData = "foobar";
-        final byte[] contents = strData.getBytes();
-        final InputStream input = new ByteArrayInputStream(contents);
-        final byte[] boundary = BOUNDARY_TEXT.getBytes();
-        final MultipartStream ms = new MultipartStream(input, boundary, new 
MultipartStream.ProgressNotifier(null, contents.length));
-        assertNotNull(ms);
-    }
-
     @Test
     public void testMalformedUploadTruncatedHeaders()
             throws IOException, FileUploadException {
@@ -118,4 +86,36 @@ public class MultipartStreamTest {
         final FileUploadException e = assertThrows(FileUploadException.class, 
() -> upload.parseRequest(req));
         assertInstanceOf(MalformedStreamException.class, e.getCause());
     }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testSmallBuffer() throws Exception {
+        final String strData = "foobar";
+        final byte[] contents = strData.getBytes();
+        final InputStream input = new ByteArrayInputStream(contents);
+        final byte[] boundary = BOUNDARY_TEXT.getBytes();
+        final int iBufSize = 1;
+        @SuppressWarnings("unused")
+        final MultipartStream unused = new MultipartStream(input, boundary, 
iBufSize, new MultipartStream.ProgressNotifier(null, contents.length));
+    }
+
+    @Test
+    public void testThreeParamConstructor() throws Exception {
+        final String strData = "foobar";
+        final byte[] contents = strData.getBytes();
+        final InputStream input = new ByteArrayInputStream(contents);
+        final byte[] boundary = BOUNDARY_TEXT.getBytes();
+        final int iBufSize = boundary.length + 
MultipartStream.BOUNDARY_PREFIX.length + 1;
+        final MultipartStream ms = new MultipartStream(input, boundary, 
iBufSize, new MultipartStream.ProgressNotifier(null, contents.length));
+        assertNotNull(ms);
+    }
+
+    @Test
+    public void testTwoParamConstructor() throws Exception {
+        final String strData = "foobar";
+        final byte[] contents = strData.getBytes();
+        final InputStream input = new ByteArrayInputStream(contents);
+        final byte[] boundary = BOUNDARY_TEXT.getBytes();
+        final MultipartStream ms = new MultipartStream(input, boundary, new 
MultipartStream.ProgressNotifier(null, contents.length));
+        assertNotNull(ms);
+    }
 }
diff --git a/src/test/java/org/apache/commons/fileupload/SizesTest.java 
b/src/test/java/org/apache/commons/fileupload/SizesTest.java
index 73e1b0dc..90ae6f21 100644
--- a/src/test/java/org/apache/commons/fileupload/SizesTest.java
+++ b/src/test/java/org/apache/commons/fileupload/SizesTest.java
@@ -217,42 +217,6 @@ public class SizesTest {
         }
     }
 
-    /** Checks, whether the maxSize works.
-     */
-    @Test
-    public void testPartHeaderSizeMaxLimit()
-            throws IOException, FileUploadException {
-        final String request =
-            "-----1234\r\n" +
-            "Content-Disposition: form-data; name=\"file1\"; 
filename=\"foo1.tab\"\r\n" +
-            "Content-Type: text/whatever\r\n" +
-            "Content-Length: 10\r\n" +
-            "\r\n" +
-            "This is the content of the file\n" +
-            "\r\n" +
-            "-----1234\r\n" +
-            "Content-Disposition: form-data; name=\"file2\"; 
filename=\"foo2.tab\"\r\n" +
-            "Content-Type: text/whatever\r\n" +
-            "\r\n" +
-            "This is the content of the file\n" +
-            "\r\n" +
-            "-----1234--\r\n";
-
-        final ServletFileUpload upload = new ServletFileUpload(new 
DiskFileItemFactory());
-        upload.setFileSizeMax(-1);
-        upload.setSizeMax(-1);
-        upload.setPartHeaderSizeMax(100);
-
-        final MockHttpServletRequest req = new MockHttpServletRequest(
-                request.getBytes("US-ASCII"), Constants.CONTENT_TYPE);
-        try {
-            upload.parseRequest(req);
-            fail("Expected exception.");
-        } catch (final FileUploadBase.SizeLimitExceededException e) {
-            assertEquals(100, e.getPermittedSize());
-        }
-    }
-
     @Test
     public void testMaxSizeLimitUnknownContentLength()
             throws IOException, FileUploadException {
@@ -316,4 +280,40 @@ public class SizesTest {
             // expected
         }
     }
+
+    /** Checks, whether the maxSize works.
+     */
+    @Test
+    public void testPartHeaderSizeMaxLimit()
+            throws IOException, FileUploadException {
+        final String request =
+            "-----1234\r\n" +
+            "Content-Disposition: form-data; name=\"file1\"; 
filename=\"foo1.tab\"\r\n" +
+            "Content-Type: text/whatever\r\n" +
+            "Content-Length: 10\r\n" +
+            "\r\n" +
+            "This is the content of the file\n" +
+            "\r\n" +
+            "-----1234\r\n" +
+            "Content-Disposition: form-data; name=\"file2\"; 
filename=\"foo2.tab\"\r\n" +
+            "Content-Type: text/whatever\r\n" +
+            "\r\n" +
+            "This is the content of the file\n" +
+            "\r\n" +
+            "-----1234--\r\n";
+
+        final ServletFileUpload upload = new ServletFileUpload(new 
DiskFileItemFactory());
+        upload.setFileSizeMax(-1);
+        upload.setSizeMax(-1);
+        upload.setPartHeaderSizeMax(100);
+
+        final MockHttpServletRequest req = new MockHttpServletRequest(
+                request.getBytes("US-ASCII"), Constants.CONTENT_TYPE);
+        try {
+            upload.parseRequest(req);
+            fail("Expected exception.");
+        } catch (final FileUploadBase.SizeLimitExceededException e) {
+            assertEquals(100, e.getPermittedSize());
+        }
+    }
 }

Reply via email to