You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by jo...@apache.org on 2020/05/25 19:29:02 UTC

[commons-fileupload] 04/04: Merge in Github PR #24.

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

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

commit 49428011a3ae8cd99132093396e344901fba8a7d
Author: Jochen Wiedmann <jo...@gmail.com>
AuthorDate: Mon May 25 21:28:55 2020 +0200

    Merge in Github PR #24.
---
 pom.xml                                               |  4 ++++
 src/changes/changes.xml                               |  4 +++-
 .../commons/fileupload2/util/mime/RFC2231Utility.java | 19 +++++++++----------
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/pom.xml b/pom.xml
index a5a2949..5bb5e5b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -179,6 +179,10 @@
     <contributor>
       <name>David Georg Reichelt</name>
     </contributor>
+    <contributor>
+      <name>Merbin J Anselm</name>
+      <email>merbinjanselm@gmail.com</email>
+    </contributor>
   </contributors>
 
   <scm>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1cd5908..e1d7edd 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -51,7 +51,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action                        dev="jochen" type="add">Add the package org.apache.fileupload2.jaksrvlt,
         for compliance with Jakarta Servlet API 5.0.
       </action>
-      <action                        dev="jochen" type="add">Making FileUploadException a subclass of IOException. (Mibor API simplification.)
+      <action                        dev="jochen" type="add">Making FileUploadException a subclass of IOException. (Mibor API simplification.)</action>
+      <action issue="FILEUPLOAD-274" dev="jochen" due-to="Merbin J Anselm" due-to-email="merbinjanselm@gmail.com">
+        RFC 5987 compliance
       </action>
     </release>
     <release version="1.4" date="2018-12-23" description="1.4 Release">
diff --git a/src/main/java/org/apache/commons/fileupload2/util/mime/RFC2231Utility.java b/src/main/java/org/apache/commons/fileupload2/util/mime/RFC2231Utility.java
index 955d185..427878e 100644
--- a/src/main/java/org/apache/commons/fileupload2/util/mime/RFC2231Utility.java
+++ b/src/main/java/org/apache/commons/fileupload2/util/mime/RFC2231Utility.java
@@ -22,8 +22,8 @@ import java.io.UnsupportedEncodingException;
  * Utility class to decode/encode character set on HTTP Header fields based on RFC 2231.
  * This implementation adheres to RFC 5987 in particular, which was defined for HTTP headers
  * 
- * RFC 5987 builds on RFC 2231, but has lesser scope like <a href="https://tools.ietf.org/html/rfc5987#section-3.2>mandatory charset definition</a>
- * and <a href="https://tools.ietf.org/html/rfc5987#section-4>no parameter continuation</a>
+ * RFC 5987 builds on RFC 2231, but has lesser scope like <a href="https://tools.ietf.org/html/rfc5987#section-3.2">mandatory charset definition</a>
+ * and <a href="https://tools.ietf.org/html/rfc5987#section-4">no parameter continuation</a>
  * 
  * <p>
  * @see <a href="https://tools.ietf.org/html/rfc2231">RFC 2231</a>
@@ -46,7 +46,7 @@ public final class RFC2231Utility {
     /**
      * Checks if Asterisk (*) at the end of parameter name to indicate,
      * if it has charset and language information to decode the value
-     * @param paramName
+     * @param paramName The parameter, which is being checked.
      * @return {@code true}, if encoded as per RFC 2231, {@code false} otherwise
      */
     public static boolean hasEncodedValue(String paramName) {
@@ -59,7 +59,7 @@ public final class RFC2231Utility {
     /**
      * If {@code paramName} has Asterisk (*) at the end, it will be stripped off, 
      * else the passed value will be returned
-     * @param paramName
+     * @param paramName The parameter, which is being inspected.
      * @return stripped {@code paramName} of Asterisk (*), if RFC2231 encoded
      */
     public static String stripDelimiter(String paramName) {
@@ -74,19 +74,18 @@ public final class RFC2231Utility {
     /**
      * Decode a string of text obtained from a HTTP header as per RFC 2231
      * 
-     * <p/>
      * <b>Eg 1.</b> {@code us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A}
      * will be decoded to {@code This is ***fun***}
-     * <p/>
+     *
      * <b>Eg 2.</b> {@code iso-8859-1'en'%A3%20rate}
-     * will be decoded to {@code £ rate}
-     * <p/>
+     * will be decoded to {@code £ rate}.
+     *
      * <b>Eg 3.</b> {@code UTF-8''%c2%a3%20and%20%e2%82%ac%20rates}
-     * will be decoded to {@code £ and € rates}
+     * will be decoded to {@code £ and € rates}.
      * 
      * @param encodedText - Text to be decoded has a format of {@code <charset>'<language>'<encoded_value>} and ASCII only
      * @return Decoded text based on charset encoding
-     * @throws UnsupportedEncodingException
+     * @throws UnsupportedEncodingException The requested character set wasn't found.
      */
     public static String decodeText(String encodedText) throws UnsupportedEncodingException {
         int langDelimitStart = encodedText.indexOf('\'');