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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7df53e41 Sort members
7df53e41 is described below

commit 7df53e41a522f3698efaf3615a56fe0ef6bdfc3b
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Jun 20 21:23:39 2026 +0000

    Sort members
---
 .../commons/fileupload2/core/RFC2231Utils.java     | 10 ++---
 .../fileupload2/core/RFC2231UtilityTestCase.java   | 48 +++++++++++-----------
 2 files changed, 29 insertions(+), 29 deletions(-)

diff --git 
a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/RFC2231Utils.java
 
b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/RFC2231Utils.java
index e3ade681..73f415cb 100644
--- 
a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/RFC2231Utils.java
+++ 
b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/RFC2231Utils.java
@@ -86,11 +86,6 @@ final class RFC2231Utils {
     }
 
 
-    static boolean isAttrChar(final char c) {
-        return c < ASCII_CODE_POINT_COUNT && ATTR_CHAR[c];
-    }
-
-
     /**
      * Decodes a string of text obtained from a HTTP header as per RFC 2231
      *
@@ -157,6 +152,7 @@ final class RFC2231Utils {
         return out.toByteArray();
     }
 
+
     private static String getJavaCharset(final String mimeCharset) {
         // good enough for standard values
         return mimeCharset;
@@ -175,6 +171,10 @@ final class RFC2231Utils {
         return false;
     }
 
+    static boolean isAttrChar(final char c) {
+        return c < ASCII_CODE_POINT_COUNT && ATTR_CHAR[c];
+    }
+
     /**
      * If {@code paramName} has Asterisk (*) at the end, it will be stripped 
off, else the passed value will be returned.
      *
diff --git 
a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/RFC2231UtilityTestCase.java
 
b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/RFC2231UtilityTestCase.java
index d6825ae9..bd04552f 100644
--- 
a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/RFC2231UtilityTestCase.java
+++ 
b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/RFC2231UtilityTestCase.java
@@ -41,16 +41,38 @@ public final class RFC2231UtilityTestCase {
         assertThrows(UnsupportedEncodingException.class, () -> 
RFC2231Utils.decodeText("abc'en'hello"));
     }
 
+    @Test
+    void testDecodeInvalidHex() throws Exception {
+        assertThrows(IllegalArgumentException.class, () -> 
RFC2231Utils.decodeText("ISO-8859-1''hello%HHworld"));
+    }
+
+    @Test
+    void testDecodeInvalidPercentEncoded() throws Exception {
+        assertThrows(IllegalArgumentException.class, () -> 
RFC2231Utils.decodeText("ISO-8859-1''hello%3\u8a35"));
+    }
+
     @Test
     void testDecodeIso88591() throws Exception {
         assertEncoded("\u00A3 rate", "iso-8859-1'en'%A3%20rate"); // "£ rate"
     }
 
+    @Test
+    void testDecodeNonTokenCharacters() throws Exception {
+        assertThrows(IllegalArgumentException.class, () -> 
RFC2231Utils.decodeText("ISO-8859-1''Not*allowed"));
+    }
+
     @Test
     void testDecodeUtf8() throws Exception {
         assertEncoded("\u00a3 \u0061\u006e\u0064 \u20ac 
\u0072\u0061\u0074\u0065\u0073", "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates"); // 
"£ and € rates"
     }
 
+
+    @Test
+    void testDecodeUTF8Characters() throws Exception {
+        assertThrows(IllegalArgumentException.class, () -> 
RFC2231Utils.decodeText("UTF-8''\\u8a2e"));
+    }
+
+
     @Test
     void testHasEncodedValue() {
         final var nameWithAsteriskAtEnd = "paramname*";
@@ -63,11 +85,12 @@ public final class RFC2231UtilityTestCase {
         assertFalse(RFC2231Utils.hasEncodedValue(nameWithoutAsterisk));
     }
 
+
     @Test
     void testNoNeedToDecode() throws Exception {
         assertEncoded("abc", "abc");
     }
-
+    
     @Test
     void testStripDelimiter() {
         final var nameWithAsteriskAtEnd = "paramname*";
@@ -82,27 +105,4 @@ public final class RFC2231UtilityTestCase {
         final var nameWithoutAsterisk = "paramname";
         assertEquals("paramname", 
RFC2231Utils.stripDelimiter(nameWithoutAsterisk));
     }
-
-
-    @Test
-    void testDecodeNonTokenCharacters() throws Exception {
-        assertThrows(IllegalArgumentException.class, () -> 
RFC2231Utils.decodeText("ISO-8859-1''Not*allowed"));
-    }
-
-
-    @Test
-    void testDecodeUTF8Characters() throws Exception {
-        assertThrows(IllegalArgumentException.class, () -> 
RFC2231Utils.decodeText("UTF-8''\\u8a2e"));
-    }
-
-
-    @Test
-    void testDecodeInvalidHex() throws Exception {
-        assertThrows(IllegalArgumentException.class, () -> 
RFC2231Utils.decodeText("ISO-8859-1''hello%HHworld"));
-    }
-    
-    @Test
-    void testDecodeInvalidPercentEncoded() throws Exception {
-        assertThrows(IllegalArgumentException.class, () -> 
RFC2231Utils.decodeText("ISO-8859-1''hello%3\u8a35"));
-    }
 }

Reply via email to