You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/06/06 14:29:12 UTC

[commons-fileupload] branch master updated (0966717 -> e6be078)

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

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


    from 0966717  Migrate from deprecated API
     new 80823cd  Hide implementation details
     new 1ac17bb  Rename some internal classes
     new dbed6f8  Better variable names
     new d583658  Javadoc
     new ce43505  Better literal
     new f851784  Clean up imports
     new 91cf761  changes.xml fails XML schema validation
     new 189e315  Type-safe charset handling
     new e6be078  Javadoc

The 9 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/commons/fileupload2/FileItem.java   |  8 ++--
 .../{mime/MimeUtility.java => MimeUtils.java}      |  8 ++--
 .../commons/fileupload2/ParameterParser.java       | 15 +++---
 .../fileupload2/{mime => }/ParseException.java     |  2 +-
 .../{mime => }/QuotedPrintableDecoder.java         |  2 +-
 .../RFC2231Utility.java => RFC2231Utils.java}      | 12 ++---
 .../commons/fileupload2/disk/DiskFileItem.java     | 24 +++++-----
 .../fileupload2/disk/DiskFileItemFactory.java      |  9 ++--
 .../commons/fileupload2/mime/package-info.java     | 22 ---------
 .../commons/fileupload2/FileItemHeadersTest.java   | 42 ++++++++--------
 .../{mime => }/MimeUtilityTestCase.java            |  6 +--
 .../{mime => }/QuotedPrintableDecoderTestCase.java |  2 +-
 .../{mime => }/RFC2231UtilityTestCase.java         | 20 ++++----
 .../jakarta/JakartaServletFileUploadTest.java      |  2 +-
 .../javax/JavaxServletFileUploadTest.java          |  2 +-
 src/changes/changes.xml                            | 56 +++++-----------------
 16 files changed, 88 insertions(+), 144 deletions(-)
 rename commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/{mime/MimeUtility.java => MimeUtils.java} (98%)
 rename commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/{mime => }/ParseException.java (96%)
 rename commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/{mime => }/QuotedPrintableDecoder.java (98%)
 rename commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/{mime/RFC2231Utility.java => RFC2231Utils.java} (94%)
 delete mode 100644 commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/package-info.java
 rename commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/{mime => }/MimeUtilityTestCase.java (94%)
 rename commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/{mime => }/QuotedPrintableDecoderTestCase.java (98%)
 rename commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/{mime => }/RFC2231UtilityTestCase.java (78%)


[commons-fileupload] 08/09: Type-safe charset handling

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 189e3155007466135036af7ecda1e543424f9bb0
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 6 10:23:23 2023 -0400

    Type-safe charset handling
    
    Fail faster on invalid charsets
    Don't allow invalid charsets in APIs
---
 .../commons/fileupload2/disk/DiskFileItem.java     | 24 ++++++++++------------
 .../fileupload2/disk/DiskFileItemFactory.java      |  7 ++++---
 .../jakarta/JakartaServletFileUploadTest.java      |  2 +-
 .../javax/JavaxServletFileUploadTest.java          |  2 +-
 4 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItem.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItem.java
index b904e23..dad510a 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItem.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItem.java
@@ -23,7 +23,9 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.UncheckedIOException;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
+import java.nio.charset.UnsupportedCharsetException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.Map;
@@ -35,6 +37,7 @@ import org.apache.commons.fileupload2.FileItemHeaders;
 import org.apache.commons.fileupload2.FileUploadException;
 import org.apache.commons.fileupload2.InvalidFileNameException;
 import org.apache.commons.fileupload2.ParameterParser;
+import org.apache.commons.io.Charsets;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.function.Uncheck;
 import org.apache.commons.io.output.DeferredFileOutputStream;
@@ -63,7 +66,7 @@ public class DiskFileItem implements FileItem {
      * Default content charset to be used when no explicit charset parameter is provided by the sender. Media subtypes of the "text" type are defined to have a
      * default charset value of "ISO-8859-1" when received via HTTP.
      */
-    public static final String DEFAULT_CHARSET = StandardCharsets.ISO_8859_1.name();
+    public static final Charset DEFAULT_CHARSET = StandardCharsets.ISO_8859_1;
 
     /**
      * UID used in unique file name generation.
@@ -179,7 +182,7 @@ public class DiskFileItem implements FileItem {
     /**
      * Default content charset to be used when no explicit charset parameter is provided by the sender.
      */
-    private String defaultCharset = DEFAULT_CHARSET;
+    private Charset defaultCharset = DEFAULT_CHARSET;
 
     /**
      * Constructs a new {@code DiskFileItem} instance.
@@ -240,12 +243,12 @@ public class DiskFileItem implements FileItem {
      *
      * @return The content charset passed by the agent or {@code null} if not defined.
      */
-    public String getCharset() {
+    public Charset getCharset() {
         final ParameterParser parser = new ParameterParser();
         parser.setLowerCaseNames(true);
         // Parameter parser can handle null input
         final Map<String, String> params = parser.parse(getContentType(), ';');
-        return params.get("charset");
+        return Charsets.toCharset(params.get("charset"), defaultCharset);
     }
 
     /**
@@ -263,7 +266,7 @@ public class DiskFileItem implements FileItem {
      *
      * @return the default charset
      */
-    public String getDefaultCharset() {
+    public Charset getDefaultCharset() {
         return defaultCharset;
     }
 
@@ -379,13 +382,8 @@ public class DiskFileItem implements FileItem {
     @Override
     public String getString() {
         try {
-            final byte[] rawData = get();
-            String charset = getCharset();
-            if (charset == null) {
-                charset = defaultCharset;
-            }
-            return new String(rawData, charset);
-        } catch (final IOException e) {
+            return new String(get(), getCharset());
+        } catch (final UnsupportedCharsetException e) {
             return "";
         }
     }
@@ -452,7 +450,7 @@ public class DiskFileItem implements FileItem {
      *
      * @param charset the default charset
      */
-    public void setDefaultCharset(final String charset) {
+    public void setDefaultCharset(final Charset charset) {
         defaultCharset = charset;
     }
 
diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItemFactory.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItemFactory.java
index 18e66f3..92a13a7 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItemFactory.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItemFactory.java
@@ -17,6 +17,7 @@
 package org.apache.commons.fileupload2.disk;
 
 import java.io.File;
+import java.nio.charset.Charset;
 
 import org.apache.commons.fileupload2.FileItem;
 import org.apache.commons.fileupload2.FileItemFactory;
@@ -79,7 +80,7 @@ public class DiskFileItemFactory implements FileItemFactory {
     /**
      * Default content charset to be used when no explicit charset parameter is provided by the sender.
      */
-    private String defaultCharset = DiskFileItem.DEFAULT_CHARSET;
+    private Charset defaultCharset = DiskFileItem.DEFAULT_CHARSET;
 
     /**
      * Constructs an unconfigured instance of this class. The resulting factory may be configured by calling the appropriate setter methods.
@@ -124,7 +125,7 @@ public class DiskFileItemFactory implements FileItemFactory {
      *
      * @return the default charset
      */
-    public String getDefaultCharset() {
+    public Charset getDefaultCharset() {
         return defaultCharset;
     }
 
@@ -162,7 +163,7 @@ public class DiskFileItemFactory implements FileItemFactory {
      *
      * @param charset the default charset
      */
-    public void setDefaultCharset(final String charset) {
+    public void setDefaultCharset(final Charset charset) {
         defaultCharset = charset;
     }
 
diff --git a/commons-fileupload2-jakarta/src/test/java/org/apache/commons/fileupload2/jakarta/JakartaServletFileUploadTest.java b/commons-fileupload2-jakarta/src/test/java/org/apache/commons/fileupload2/jakarta/JakartaServletFileUploadTest.java
index 4e7fb79..9c299a5 100644
--- a/commons-fileupload2-jakarta/src/test/java/org/apache/commons/fileupload2/jakarta/JakartaServletFileUploadTest.java
+++ b/commons-fileupload2-jakarta/src/test/java/org/apache/commons/fileupload2/jakarta/JakartaServletFileUploadTest.java
@@ -59,7 +59,7 @@ public class JakartaServletFileUploadTest extends AbstractFileUploadTest<Jakarta
         final HttpServletRequest request = new JakartaMockServletHttpRequest(bytes, Constants.CONTENT_TYPE);
 
         final DiskFileItemFactory fileItemFactory = new DiskFileItemFactory();
-        fileItemFactory.setDefaultCharset("UTF-8");
+        fileItemFactory.setDefaultCharset(StandardCharsets.UTF_8);
         final JakartaServletFileUpload upload = new JakartaServletFileUpload(fileItemFactory);
         final List<FileItem> fileItems = upload.parseRequest(request);
         final FileItem fileItem = fileItems.get(0);
diff --git a/commons-fileupload2-javax/src/test/java/org/apache/commons/fileupload2/javax/JavaxServletFileUploadTest.java b/commons-fileupload2-javax/src/test/java/org/apache/commons/fileupload2/javax/JavaxServletFileUploadTest.java
index a4d4d00..ec98fdf 100644
--- a/commons-fileupload2-javax/src/test/java/org/apache/commons/fileupload2/javax/JavaxServletFileUploadTest.java
+++ b/commons-fileupload2-javax/src/test/java/org/apache/commons/fileupload2/javax/JavaxServletFileUploadTest.java
@@ -63,7 +63,7 @@ public class JavaxServletFileUploadTest extends AbstractFileUploadTest<JavaxServ
         final HttpServletRequest request = new JavaxMockHttpServletRequest(bytes, Constants.CONTENT_TYPE);
 
         final DiskFileItemFactory fileItemFactory = new DiskFileItemFactory();
-        fileItemFactory.setDefaultCharset("UTF-8");
+        fileItemFactory.setDefaultCharset(StandardCharsets.UTF_8);
         final JavaxServletFileUpload upload = new JavaxServletFileUpload(fileItemFactory);
         final List<FileItem> fileItems = upload.parseRequest(request);
         final FileItem fileItem = fileItems.get(0);


[commons-fileupload] 03/09: Better variable names

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit dbed6f81aef90ed3f841091c98a9725737fd0315
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 6 08:50:07 2023 -0400

    Better variable names
---
 .../commons/fileupload2/FileItemHeadersTest.java   | 42 +++++++++++-----------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/FileItemHeadersTest.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/FileItemHeadersTest.java
index 1a896dd..173a8ee 100644
--- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/FileItemHeadersTest.java
+++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/FileItemHeadersTest.java
@@ -35,40 +35,40 @@ public class FileItemHeadersTest {
      */
     @Test
     public void testFileItemHeaders() throws Exception {
-        final FileItemHeadersImpl aMutableFileItemHeaders = new FileItemHeadersImpl();
-        aMutableFileItemHeaders.addHeader("Content-Disposition", "form-data; name=\"FileItem\"; filename=\"file1.txt\"");
-        aMutableFileItemHeaders.addHeader("Content-Type", "text/plain");
+        final FileItemHeadersImpl mutableFileItemHeaders = new FileItemHeadersImpl();
+        mutableFileItemHeaders.addHeader("Content-Disposition", "form-data; name=\"FileItem\"; filename=\"file1.txt\"");
+        mutableFileItemHeaders.addHeader("Content-Type", "text/plain");
 
-        aMutableFileItemHeaders.addHeader("TestHeader", "headerValue1");
-        aMutableFileItemHeaders.addHeader("TestHeader", "headerValue2");
-        aMutableFileItemHeaders.addHeader("TestHeader", "headerValue3");
-        aMutableFileItemHeaders.addHeader("testheader", "headerValue4");
+        mutableFileItemHeaders.addHeader("TestHeader", "headerValue1");
+        mutableFileItemHeaders.addHeader("TestHeader", "headerValue2");
+        mutableFileItemHeaders.addHeader("TestHeader", "headerValue3");
+        mutableFileItemHeaders.addHeader("testheader", "headerValue4");
 
-        final Iterator<String> headerNameEnumeration = aMutableFileItemHeaders.getHeaderNames();
-        assertEquals("content-disposition", headerNameEnumeration.next());
-        assertEquals("content-type", headerNameEnumeration.next());
-        assertEquals("testheader", headerNameEnumeration.next());
-        assertFalse(headerNameEnumeration.hasNext());
+        final Iterator<String> headerNameIterator = mutableFileItemHeaders.getHeaderNames();
+        assertEquals("content-disposition", headerNameIterator.next());
+        assertEquals("content-type", headerNameIterator.next());
+        assertEquals("testheader", headerNameIterator.next());
+        assertFalse(headerNameIterator.hasNext());
 
-        assertEquals(aMutableFileItemHeaders.getHeader("Content-Disposition"), "form-data; name=\"FileItem\"; filename=\"file1.txt\"");
-        assertEquals(aMutableFileItemHeaders.getHeader("Content-Type"), "text/plain");
-        assertEquals(aMutableFileItemHeaders.getHeader("content-type"), "text/plain");
-        assertEquals(aMutableFileItemHeaders.getHeader("TestHeader"), "headerValue1");
-        assertNull(aMutableFileItemHeaders.getHeader("DummyHeader"));
+        assertEquals(mutableFileItemHeaders.getHeader("Content-Disposition"), "form-data; name=\"FileItem\"; filename=\"file1.txt\"");
+        assertEquals(mutableFileItemHeaders.getHeader("Content-Type"), "text/plain");
+        assertEquals(mutableFileItemHeaders.getHeader("content-type"), "text/plain");
+        assertEquals(mutableFileItemHeaders.getHeader("TestHeader"), "headerValue1");
+        assertNull(mutableFileItemHeaders.getHeader("DummyHeader"));
 
         Iterator<String> headerValueEnumeration;
 
-        headerValueEnumeration = aMutableFileItemHeaders.getHeaders("Content-Type");
+        headerValueEnumeration = mutableFileItemHeaders.getHeaders("Content-Type");
         assertTrue(headerValueEnumeration.hasNext());
         assertEquals(headerValueEnumeration.next(), "text/plain");
         assertFalse(headerValueEnumeration.hasNext());
 
-        headerValueEnumeration = aMutableFileItemHeaders.getHeaders("content-type");
+        headerValueEnumeration = mutableFileItemHeaders.getHeaders("content-type");
         assertTrue(headerValueEnumeration.hasNext());
         assertEquals(headerValueEnumeration.next(), "text/plain");
         assertFalse(headerValueEnumeration.hasNext());
 
-        headerValueEnumeration = aMutableFileItemHeaders.getHeaders("TestHeader");
+        headerValueEnumeration = mutableFileItemHeaders.getHeaders("TestHeader");
         assertTrue(headerValueEnumeration.hasNext());
         assertEquals(headerValueEnumeration.next(), "headerValue1");
         assertTrue(headerValueEnumeration.hasNext());
@@ -79,7 +79,7 @@ public class FileItemHeadersTest {
         assertEquals(headerValueEnumeration.next(), "headerValue4");
         assertFalse(headerValueEnumeration.hasNext());
 
-        headerValueEnumeration = aMutableFileItemHeaders.getHeaders("DummyHeader");
+        headerValueEnumeration = mutableFileItemHeaders.getHeaders("DummyHeader");
         assertFalse(headerValueEnumeration.hasNext());
     }
 


[commons-fileupload] 06/09: Clean up imports

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f851784d3cbe224827afbab8a6405ed24e4f6197
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 6 08:55:03 2023 -0400

    Clean up imports
---
 .../test/java/org/apache/commons/fileupload2/MimeUtilityTestCase.java    | 1 -
 .../org/apache/commons/fileupload2/QuotedPrintableDecoderTestCase.java   | 1 -
 .../test/java/org/apache/commons/fileupload2/RFC2231UtilityTestCase.java | 1 -
 3 files changed, 3 deletions(-)

diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/MimeUtilityTestCase.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/MimeUtilityTestCase.java
index 1dc99f5..a56b439 100644
--- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/MimeUtilityTestCase.java
+++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/MimeUtilityTestCase.java
@@ -21,7 +21,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.io.UnsupportedEncodingException;
 
-import org.apache.commons.fileupload2.MimeUtils;
 import org.junit.jupiter.api.Test;
 
 /**
diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/QuotedPrintableDecoderTestCase.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/QuotedPrintableDecoderTestCase.java
index c53dc33..542052e 100644
--- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/QuotedPrintableDecoderTestCase.java
+++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/QuotedPrintableDecoderTestCase.java
@@ -25,7 +25,6 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 
-import org.apache.commons.fileupload2.QuotedPrintableDecoder;
 import org.junit.jupiter.api.Test;
 
 /**
diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/RFC2231UtilityTestCase.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/RFC2231UtilityTestCase.java
index 1bf3fd2..b2f276e 100644
--- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/RFC2231UtilityTestCase.java
+++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/RFC2231UtilityTestCase.java
@@ -23,7 +23,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.UnsupportedEncodingException;
 
-import org.apache.commons.fileupload2.RFC2231Utils;
 import org.junit.jupiter.api.Test;
 
 /**


[commons-fileupload] 09/09: Javadoc

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e6be07819a804bbf4d218778b086b4edf0a69c8e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 6 10:29:07 2023 -0400

    Javadoc
---
 .../main/java/org/apache/commons/fileupload2/ParameterParser.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParameterParser.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParameterParser.java
index ad6d804..cd65201 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParameterParser.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParameterParser.java
@@ -133,7 +133,7 @@ public class ParameterParser {
     }
 
     /**
-     * Extracts a map of name/value pairs from the given array of characters. Names are expected to be unique.
+     * Parses a map of name/value pairs from the given array of characters. Names are expected to be unique.
      *
      * @param charArray the array of characters that contains a sequence of name/value pairs
      * @param separator the name/value pairs separator
@@ -147,7 +147,7 @@ public class ParameterParser {
     }
 
     /**
-     * Extracts a map of name/value pairs from the given array of characters. Names are expected to be unique.
+     * Parses a map of name/value pairs from the given array of characters. Names are expected to be unique.
      *
      * @param charArray the array of characters that contains a sequence of name/value pairs
      * @param offset    - the initial offset.
@@ -197,7 +197,7 @@ public class ParameterParser {
     }
 
     /**
-     * Extracts a map of name/value pairs from the given string. Names are expected to be unique.
+     * Parses a map of name/value pairs from the given string. Names are expected to be unique.
      *
      * @param str       the string that contains a sequence of name/value pairs
      * @param separator the name/value pairs separator
@@ -211,7 +211,7 @@ public class ParameterParser {
     }
 
     /**
-     * Extracts a map of name/value pairs from the given string. Names are expected to be unique. Multiple separators may be specified and the earliest found in
+     * Parses a map of name/value pairs from the given string. Names are expected to be unique. Multiple separators may be specified and the earliest found in
      * the input string is used.
      *
      * @param str        the string that contains a sequence of name/value pairs


[commons-fileupload] 04/09: Javadoc

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d5836583965b4b21d8274b2e63933b1f8a10df5d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 6 08:51:25 2023 -0400

    Javadoc
---
 .../src/main/java/org/apache/commons/fileupload2/FileItem.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/FileItem.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/FileItem.java
index ff3da7f..9548186 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/FileItem.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/FileItem.java
@@ -30,11 +30,11 @@ import java.io.UnsupportedEncodingException;
  * <p>
  * After retrieving an instance of this class from a {@link org.apache.commons.fileupload2.FileUpload FileUpload} instance (see
  * {@code org.apache.commons.fileupload2.servlet.ServletFileUpload #parseRequest(javax.servlet.http.HttpServletRequest)}), you may either request all contents
- * of the file at once using {@link #get()} or request an {@link java.io.InputStream InputStream} with {@link #getInputStream()} and process the file without
+ * of the file at once using {@link #get()} or request an {@link InputStream} with {@link #getInputStream()} and process the file without
  * attempting to load it into memory, which may come handy with large files.
  * </p>
  * <p>
- * While this interface does not extend {@code javax.activation.DataSource} per se (to avoid a seldom used dependency), several of the defined methods are
+ * While this interface does not extend {@code javax.activation.DataSource} (to avoid a seldom used dependency), several of the defined methods are
  * specifically defined with the same signatures as methods in that interface. This allows an implementation of this interface to also implement
  * {@code javax.activation.DataSource} with minimal additional work.
  * </p>
@@ -49,9 +49,9 @@ public interface FileItem extends FileItemHeadersSupport {
     void delete();
 
     /**
-     * Returns the contents of the file item as an array of bytes.
+     * Gets the contents of the file item as a byte array.
      *
-     * @return The contents of the file item as an array of bytes.
+     * @return The contents of the file item as a byte array.
      *
      * @throws UncheckedIOException if an I/O error occurs
      */


[commons-fileupload] 01/09: Hide implementation details

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 80823cd4e9a419adfd9c0ad7cccb5ae95162e2aa
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 6 08:39:32 2023 -0400

    Hide implementation details
---
 .../fileupload2/{mime => }/MimeUtility.java        |  6 +++---
 .../commons/fileupload2/ParameterParser.java       |  3 ---
 .../fileupload2/{mime => }/ParseException.java     |  2 +-
 .../{mime => }/QuotedPrintableDecoder.java         |  2 +-
 .../fileupload2/{mime => }/RFC2231Utility.java     | 10 +++++-----
 .../commons/fileupload2/mime/package-info.java     | 22 ----------------------
 .../{mime => }/MimeUtilityTestCase.java            |  3 ++-
 .../{mime => }/QuotedPrintableDecoderTestCase.java |  3 ++-
 .../{mime => }/RFC2231UtilityTestCase.java         |  3 ++-
 9 files changed, 16 insertions(+), 38 deletions(-)

diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/MimeUtility.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/MimeUtility.java
similarity index 98%
rename from commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/MimeUtility.java
rename to commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/MimeUtility.java
index 2d7c3ab..856dbbb 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/MimeUtility.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/MimeUtility.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.fileupload2.mime;
+package org.apache.commons.fileupload2;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -28,7 +28,7 @@ import java.util.Map;
 /**
  * Utility class to decode MIME texts.
  */
-public final class MimeUtility {
+final class MimeUtility {
 
     /**
      * The marker to indicate text is encoded with BASE64 algorithm.
@@ -82,7 +82,7 @@ public final class MimeUtility {
      * @return The decoded text string.
      * @throws UnsupportedEncodingException if the detected encoding in the input text is not supported.
      */
-    public static String decodeText(final String text) throws UnsupportedEncodingException {
+    static String decodeText(final String text) throws UnsupportedEncodingException {
         // if the text contains any encoded tokens, those tokens will be marked with "=?". If the
         // source string doesn't contain that sequent, no decoding is required.
         if (!text.contains(ENCODED_TOKEN_MARKER)) {
diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParameterParser.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParameterParser.java
index e1a80ca..f832b1b 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParameterParser.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParameterParser.java
@@ -21,9 +21,6 @@ import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
 
-import org.apache.commons.fileupload2.mime.MimeUtility;
-import org.apache.commons.fileupload2.mime.RFC2231Utility;
-
 /**
  * A simple parser intended to parse sequences of name/value pairs.
  * <p>
diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/ParseException.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParseException.java
similarity index 96%
rename from commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/ParseException.java
rename to commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParseException.java
index d8e3aa1..cd2b574 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/ParseException.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParseException.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.fileupload2.mime;
+package org.apache.commons.fileupload2;
 
 /**
  */
diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/QuotedPrintableDecoder.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/QuotedPrintableDecoder.java
similarity index 98%
rename from commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/QuotedPrintableDecoder.java
rename to commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/QuotedPrintableDecoder.java
index 2335fe5..7ad823b 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/QuotedPrintableDecoder.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/QuotedPrintableDecoder.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.fileupload2.mime;
+package org.apache.commons.fileupload2;
 
 import java.io.IOException;
 import java.io.OutputStream;
diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/RFC2231Utility.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/RFC2231Utility.java
similarity index 94%
rename from commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/RFC2231Utility.java
rename to commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/RFC2231Utility.java
index 9289fba..aa51ce5 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/RFC2231Utility.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/RFC2231Utility.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.fileupload2.mime;
+package org.apache.commons.fileupload2;
 
 import java.io.ByteArrayOutputStream;
 import java.io.UnsupportedEncodingException;
@@ -30,7 +30,7 @@ import java.io.UnsupportedEncodingException;
  * @see <a href="https://tools.ietf.org/html/rfc2231">RFC 2231</a>
  * @see <a href="https://tools.ietf.org/html/rfc5987">RFC 5987</a>
  */
-public final class RFC2231Utility {
+final class RFC2231Utility {
 
     /**
      * The Hexadecimal values char array.
@@ -70,7 +70,7 @@ public final class RFC2231Utility {
      * @return Decoded text based on charset encoding
      * @throws UnsupportedEncodingException The requested character set wasn't found.
      */
-    public static String decodeText(final String encodedText) throws UnsupportedEncodingException {
+    static String decodeText(final String encodedText) throws UnsupportedEncodingException {
         final int langDelimitStart = encodedText.indexOf('\'');
         if (langDelimitStart == -1) {
             // missing charset
@@ -122,7 +122,7 @@ public final class RFC2231Utility {
      * @param paramName The parameter, which is being checked.
      * @return {@code true}, if encoded as per RFC 2231, {@code false} otherwise
      */
-    public static boolean hasEncodedValue(final String paramName) {
+    static boolean hasEncodedValue(final String paramName) {
         if (paramName != null) {
             return paramName.lastIndexOf('*') == paramName.length() - 1;
         }
@@ -135,7 +135,7 @@ public final class RFC2231Utility {
      * @param paramName The parameter, which is being inspected.
      * @return stripped {@code paramName} of Asterisk (*), if RFC2231 encoded
      */
-    public static String stripDelimiter(final String paramName) {
+    static String stripDelimiter(final String paramName) {
         if (hasEncodedValue(paramName)) {
             final StringBuilder paramBuilder = new StringBuilder(paramName);
             paramBuilder.deleteCharAt(paramName.lastIndexOf('*'));
diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/package-info.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/package-info.java
deleted file mode 100644
index ca9c417..0000000
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/mime/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * MIME decoder implementation, imported and retailed from <a href="http://svn.apache.org/repos/asf/geronimo/specs/tags/geronimo-javamail_1.4_spec-1.4/">Apache
- * Geronimo</a>.
- */
-package org.apache.commons.fileupload2.mime;
diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/mime/MimeUtilityTestCase.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/MimeUtilityTestCase.java
similarity index 96%
rename from commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/mime/MimeUtilityTestCase.java
rename to commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/MimeUtilityTestCase.java
index 46c61cb..9662306 100644
--- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/mime/MimeUtilityTestCase.java
+++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/MimeUtilityTestCase.java
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.fileupload2.mime;
+package org.apache.commons.fileupload2;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.io.UnsupportedEncodingException;
 
+import org.apache.commons.fileupload2.MimeUtility;
 import org.junit.jupiter.api.Test;
 
 /**
diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/mime/QuotedPrintableDecoderTestCase.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/QuotedPrintableDecoderTestCase.java
similarity index 97%
rename from commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/mime/QuotedPrintableDecoderTestCase.java
rename to commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/QuotedPrintableDecoderTestCase.java
index 43fb76c..c53dc33 100644
--- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/mime/QuotedPrintableDecoderTestCase.java
+++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/QuotedPrintableDecoderTestCase.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.fileupload2.mime;
+package org.apache.commons.fileupload2;
 
 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -25,6 +25,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 
+import org.apache.commons.fileupload2.QuotedPrintableDecoder;
 import org.junit.jupiter.api.Test;
 
 /**
diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/mime/RFC2231UtilityTestCase.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/RFC2231UtilityTestCase.java
similarity index 97%
rename from commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/mime/RFC2231UtilityTestCase.java
rename to commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/RFC2231UtilityTestCase.java
index 459c982..7acd2bd 100644
--- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/mime/RFC2231UtilityTestCase.java
+++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/RFC2231UtilityTestCase.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.fileupload2.mime;
+package org.apache.commons.fileupload2;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -23,6 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.UnsupportedEncodingException;
 
+import org.apache.commons.fileupload2.RFC2231Utility;
 import org.junit.jupiter.api.Test;
 
 /**


[commons-fileupload] 05/09: Better literal

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ce435053933832fcd429f86bd88e65adbe47b9ff
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 6 08:54:46 2023 -0400

    Better literal
---
 .../java/org/apache/commons/fileupload2/disk/DiskFileItemFactory.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItemFactory.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItemFactory.java
index 399c19a..18e66f3 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItemFactory.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItemFactory.java
@@ -56,7 +56,7 @@ public class DiskFileItemFactory implements FileItemFactory {
     /**
      * The default threshold above which uploads will be stored on disk.
      */
-    public static final int DEFAULT_SIZE_THRESHOLD = 10240;
+    public static final int DEFAULT_SIZE_THRESHOLD = 10_240;
 
     /**
      * The directory in which uploaded files will be stored, if stored on disk.


[commons-fileupload] 02/09: Rename some internal classes

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 1ac17bb4a1b6b8926fe8c33857be995d56af8940
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 6 08:42:34 2023 -0400

    Rename some internal classes
---
 .../fileupload2/{MimeUtility.java => MimeUtils.java} |  4 ++--
 .../apache/commons/fileupload2/ParameterParser.java  |  4 ++--
 .../{RFC2231Utility.java => RFC2231Utils.java}       |  4 ++--
 .../commons/fileupload2/MimeUtilityTestCase.java     |  6 +++---
 .../commons/fileupload2/RFC2231UtilityTestCase.java  | 20 ++++++++++----------
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/MimeUtility.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/MimeUtils.java
similarity index 99%
rename from commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/MimeUtility.java
rename to commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/MimeUtils.java
index 856dbbb..33f9c61 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/MimeUtility.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/MimeUtils.java
@@ -28,7 +28,7 @@ import java.util.Map;
 /**
  * Utility class to decode MIME texts.
  */
-final class MimeUtility {
+final class MimeUtils {
 
     /**
      * The marker to indicate text is encoded with BASE64 algorithm.
@@ -265,7 +265,7 @@ final class MimeUtility {
     /**
      * Hidden constructor, this class must not be instantiated.
      */
-    private MimeUtility() {
+    private MimeUtils() {
         // do nothing
     }
 
diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParameterParser.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParameterParser.java
index f832b1b..ad6d804 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParameterParser.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/ParameterParser.java
@@ -176,7 +176,7 @@ public class ParameterParser {
 
                 if (paramValue != null) {
                     try {
-                        paramValue = RFC2231Utility.hasEncodedValue(paramName) ? RFC2231Utility.decodeText(paramValue) : MimeUtility.decodeText(paramValue);
+                        paramValue = RFC2231Utils.hasEncodedValue(paramName) ? RFC2231Utils.decodeText(paramValue) : MimeUtils.decodeText(paramValue);
                     } catch (final UnsupportedEncodingException ignored) {
                         // let's keep the original value in this case
                     }
@@ -186,7 +186,7 @@ public class ParameterParser {
                 pos++; // skip separator
             }
             if (paramName != null && !paramName.isEmpty()) {
-                paramName = RFC2231Utility.stripDelimiter(paramName);
+                paramName = RFC2231Utils.stripDelimiter(paramName);
                 if (this.lowerCaseNames) {
                     paramName = paramName.toLowerCase(Locale.ENGLISH);
                 }
diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/RFC2231Utility.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/RFC2231Utils.java
similarity index 99%
rename from commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/RFC2231Utility.java
rename to commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/RFC2231Utils.java
index aa51ce5..b8f1ce5 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/RFC2231Utility.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/RFC2231Utils.java
@@ -30,7 +30,7 @@ import java.io.UnsupportedEncodingException;
  * @see <a href="https://tools.ietf.org/html/rfc2231">RFC 2231</a>
  * @see <a href="https://tools.ietf.org/html/rfc5987">RFC 5987</a>
  */
-final class RFC2231Utility {
+final class RFC2231Utils {
 
     /**
      * The Hexadecimal values char array.
@@ -147,6 +147,6 @@ final class RFC2231Utility {
     /**
      * Private constructor so that no instances can be created. This class contains only static utility methods.
      */
-    private RFC2231Utility() {
+    private RFC2231Utils() {
     }
 }
diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/MimeUtilityTestCase.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/MimeUtilityTestCase.java
index 9662306..1dc99f5 100644
--- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/MimeUtilityTestCase.java
+++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/MimeUtilityTestCase.java
@@ -21,7 +21,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.io.UnsupportedEncodingException;
 
-import org.apache.commons.fileupload2.MimeUtility;
+import org.apache.commons.fileupload2.MimeUtils;
 import org.junit.jupiter.api.Test;
 
 /**
@@ -30,12 +30,12 @@ import org.junit.jupiter.api.Test;
 public final class MimeUtilityTestCase {
 
     private static void assertEncoded(final String expected, final String encoded) throws Exception {
-        assertEquals(expected, MimeUtility.decodeText(encoded));
+        assertEquals(expected, MimeUtils.decodeText(encoded));
     }
 
     @Test
     public void decodeInvalidEncoding() {
-        assertThrows(UnsupportedEncodingException.class, () -> MimeUtility.decodeText("=?invalid?B?xyz-?="));
+        assertThrows(UnsupportedEncodingException.class, () -> MimeUtils.decodeText("=?invalid?B?xyz-?="));
     }
 
     @Test
diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/RFC2231UtilityTestCase.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/RFC2231UtilityTestCase.java
index 7acd2bd..1bf3fd2 100644
--- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/RFC2231UtilityTestCase.java
+++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/RFC2231UtilityTestCase.java
@@ -23,7 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.UnsupportedEncodingException;
 
-import org.apache.commons.fileupload2.RFC2231Utility;
+import org.apache.commons.fileupload2.RFC2231Utils;
 import org.junit.jupiter.api.Test;
 
 /**
@@ -34,12 +34,12 @@ import org.junit.jupiter.api.Test;
 public final class RFC2231UtilityTestCase {
 
     private static void assertEncoded(final String expected, final String encoded) throws Exception {
-        assertEquals(expected, RFC2231Utility.decodeText(encoded));
+        assertEquals(expected, RFC2231Utils.decodeText(encoded));
     }
 
     @Test
     public void decodeInvalidEncoding() throws Exception {
-        assertThrows(UnsupportedEncodingException.class, () -> RFC2231Utility.decodeText("abc'en'hello"));
+        assertThrows(UnsupportedEncodingException.class, () -> RFC2231Utils.decodeText("abc'en'hello"));
     }
 
     @Test
@@ -60,27 +60,27 @@ public final class RFC2231UtilityTestCase {
     @Test
     public void testHasEncodedValue() {
         final String nameWithAsteriskAtEnd = "paramname*";
-        assertTrue(RFC2231Utility.hasEncodedValue(nameWithAsteriskAtEnd));
+        assertTrue(RFC2231Utils.hasEncodedValue(nameWithAsteriskAtEnd));
 
         final String nameWithAsteriskNotAtEnd = "param*name";
-        assertFalse(RFC2231Utility.hasEncodedValue(nameWithAsteriskNotAtEnd));
+        assertFalse(RFC2231Utils.hasEncodedValue(nameWithAsteriskNotAtEnd));
 
         final String nameWithoutAsterisk = "paramname";
-        assertFalse(RFC2231Utility.hasEncodedValue(nameWithoutAsterisk));
+        assertFalse(RFC2231Utils.hasEncodedValue(nameWithoutAsterisk));
     }
 
     @Test
     public void testStripDelimiter() {
         final String nameWithAsteriskAtEnd = "paramname*";
-        assertEquals("paramname", RFC2231Utility.stripDelimiter(nameWithAsteriskAtEnd));
+        assertEquals("paramname", RFC2231Utils.stripDelimiter(nameWithAsteriskAtEnd));
 
         final String nameWithAsteriskNotAtEnd = "param*name";
-        assertEquals("param*name", RFC2231Utility.stripDelimiter(nameWithAsteriskNotAtEnd));
+        assertEquals("param*name", RFC2231Utils.stripDelimiter(nameWithAsteriskNotAtEnd));
 
         final String nameWithTwoAsterisks = "param*name*";
-        assertEquals("param*name", RFC2231Utility.stripDelimiter(nameWithTwoAsterisks));
+        assertEquals("param*name", RFC2231Utils.stripDelimiter(nameWithTwoAsterisks));
 
         final String nameWithoutAsterisk = "paramname";
-        assertEquals("paramname", RFC2231Utility.stripDelimiter(nameWithoutAsterisk));
+        assertEquals("paramname", RFC2231Utils.stripDelimiter(nameWithoutAsterisk));
     }
 }


[commons-fileupload] 07/09: changes.xml fails XML schema validation

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 91cf76194bf49b97ea24871610338a1d557005ed
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 6 10:08:32 2023 -0400

    changes.xml fails XML schema validation
---
 src/changes/changes.xml | 56 ++++++++++++-------------------------------------
 1 file changed, 13 insertions(+), 43 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a8032bc..bdebddf 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -461,17 +461,9 @@ fix as well as a small number of bugfixes." date="2014-02-07">
 
       <action dev="martinc" type="update">
         Build updates:
-        <ul>
-          <li>
-            Include NOTICE.txt in the jar file and distributions.
-          </li>
-          <li>
-            Include xdocs in source distribution.
-          </li>
-          <li>
-            Create MD5 checksums for distributions.
-          </li>
-        </ul>
+          (1) Include NOTICE.txt in the jar file and distributions.
+          (2) Include xdocs in source distribution.
+          (3) Create MD5 checksums for distributions.
       </action>
 
       <action dev="martinc" type="add">
@@ -517,22 +509,12 @@ fix as well as a small number of bugfixes." date="2014-02-07">
 
       <action dev="martinc" type="update">
         Web site updates:
-        <ul>
-          <li>
-            Add detail pages for Source Repository and Issue Tracking, based on
-            those for IO and Validator.
-          </li>
-          <li>
-            Improvements to FileUpload home page, based on similar recent
+          (1) Add detail pages for Source Repository and Issue Tracking, based on
+              those for IO and Validator.
+          (2) Improvements to FileUpload home page, based on similar recent
             changes to IO and Validator home pages.
-          </li>
-          <li>
-            The Bugzilla component name has a space in it. Fix the URLs.
-          </li>
-          <li>
-            Add an FAQ page, using the Maven plugin to generate it.
-          </li>
-        </ul>
+          (3) The Bugzilla component name has a space in it. Fix the URLs.
+          (4) Add an FAQ page, using the Maven plugin to generate it.
       </action>
 
       <action dev="dion" type="fix" issue="COMMONSSITE-2">
@@ -570,39 +552,27 @@ fix as well as a small number of bugfixes." date="2014-02-07">
 
       <action dev="martinc" type="update">
         Substantial refactoring and additions:
-        <ul>
-          <li>
-            The core package is now independent of servlet / portlet / other
+          (1) The core package is now independent of servlet / portlet / other
             distinctions, as well as persistence schemes, other than deprecated
             classes and methods retained for backwards compatibility.
-          </li>
-          <li>
-            Servlet specific functionality has been moved to a new 'servlet'
+          (2) Servlet specific functionality has been moved to a new 'servlet'
             package. Existing users should migrate to this as soon as possible,
             since the servlet specific functionality in the generic package
             will be removed in the release after FileUpload 1.1.
-          </li>
-          <li>
-            Support for portlets (JSR 168) has been added, in a new 'portlet'
+          (3) Support for portlets (JSR 168) has been added, in a new 'portlet'
             package. This is not well tested at this point, and feedback would
             be very much appreciated. (This also resolves bug #23620.)
-          </li>
-          <li>
-            The disk-based file item implementation has been moved into a 'disk'
+          (4) The disk-based file item implementation has been moved into a 'disk'
             package, and renamed from Default* to Disk* to reflect what it
             really is. The Default* classes have been retained in the top level
             package for backwards compatibility, but are now deprecated, and
             will be removed in the release after FileUpload 1.1.
-          </li>
-          <li>
-            The isMultipartRequest method is an unfortunate casualty of this
+          (5) The isMultipartRequest method is an unfortunate casualty of this
             refactoring. That method should really be moved to ServletFileUpload,
             but since the method is static, it can only exist in either
             FileUploadBase or ServletFileUpload. Backwards compatibility dictates
             the former for now, but the latter is the desired state, which
             implies some future breakage. Fair warning...
-          </li>
-        </ul>
       </action>
 
       <action dev="martinc" type="fix" issue="FILEUPLOAD-4">