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


The following commit(s) were added to refs/heads/master by this push:
     new 64caa71  FILEUPLOAD-334 - LineLength - Line is longer than 120 
characters
     new 5b5e8a6  Merge pull request #86 from 
arturobernalg/feature/FILEUPLOAD-334
64caa71 is described below

commit 64caa719fb84bdf6054ee716184c66716e5538f0
Author: Arturo Bernal <arturobern...@gmail.com>
AuthorDate: Fri May 7 16:17:16 2021 +0200

    FILEUPLOAD-334 - LineLength - Line is longer than 120 characters
---
 .../java/org/apache/commons/fileupload2/FileUploadBase.java  |  3 ++-
 .../commons/fileupload2/impl/FileItemIteratorImpl.java       |  3 ++-
 .../java/org/apache/commons/fileupload2/util/Streams.java    |  3 ++-
 .../apache/commons/fileupload2/util/mime/RFC2231Utility.java |  6 ++++--
 .../org/apache/commons/fileupload2/FileItemHeadersTest.java  |  6 ++++--
 .../java/org/apache/commons/fileupload2/FileUploadTest.java  | 12 ++++++++----
 .../org/apache/commons/fileupload2/ParameterParserTest.java  |  6 ++++--
 src/test/java/org/apache/commons/fileupload2/Util.java       |  3 ++-
 .../fileupload2/portlet/MockPortletActionRequest.java        |  3 ++-
 .../commons/fileupload2/util/mime/Base64DecoderTestCase.java |  3 ++-
 .../commons/fileupload2/util/mime/MimeUtilityTestCase.java   |  6 ++++--
 .../util/mime/QuotedPrintableDecoderTestCase.java            |  8 +++++---
 .../fileupload2/util/mime/RFC2231UtilityTestCase.java        |  6 ++++--
 13 files changed, 45 insertions(+), 23 deletions(-)

diff --git a/src/main/java/org/apache/commons/fileupload2/FileUploadBase.java 
b/src/main/java/org/apache/commons/fileupload2/FileUploadBase.java
index 292b3f2..f90e7e1 100644
--- a/src/main/java/org/apache/commons/fileupload2/FileUploadBase.java
+++ b/src/main/java/org/apache/commons/fileupload2/FileUploadBase.java
@@ -327,7 +327,8 @@ public abstract class FileUploadBase {
         boolean successful = false;
         try {
             final FileItemIterator iter = getItemIterator(ctx);
-            final FileItemFactory fileItemFactory = 
Objects.requireNonNull(getFileItemFactory(), "No FileItemFactory has been 
set.");
+            final FileItemFactory fileItemFactory = 
Objects.requireNonNull(getFileItemFactory(),
+                    "No FileItemFactory has been set.");
             final byte[] buffer = new byte[Streams.DEFAULT_BUFFER_SIZE];
             while (iter.hasNext()) {
                 final FileItemStream item = iter.next();
diff --git 
a/src/main/java/org/apache/commons/fileupload2/impl/FileItemIteratorImpl.java 
b/src/main/java/org/apache/commons/fileupload2/impl/FileItemIteratorImpl.java
index 4af1d60..2044d06 100644
--- 
a/src/main/java/org/apache/commons/fileupload2/impl/FileItemIteratorImpl.java
+++ 
b/src/main/java/org/apache/commons/fileupload2/impl/FileItemIteratorImpl.java
@@ -336,7 +336,8 @@ public class FileItemIteratorImpl implements 
FileItemIterator {
         final List<FileItem> items = new ArrayList<>();
         while (hasNext()) {
             final FileItemStream fis = next();
-            final FileItem fi = 
fileUploadBase.getFileItemFactory().createItem(fis.getFieldName(), 
fis.getContentType(), fis.isFormField(), fis.getName());
+            final FileItem fi = 
fileUploadBase.getFileItemFactory().createItem(fis.getFieldName(),
+                    fis.getContentType(), fis.isFormField(), fis.getName());
             items.add(fi);
         }
         return items;
diff --git a/src/main/java/org/apache/commons/fileupload2/util/Streams.java 
b/src/main/java/org/apache/commons/fileupload2/util/Streams.java
index 5f40514..2aa1302 100644
--- a/src/main/java/org/apache/commons/fileupload2/util/Streams.java
+++ b/src/main/java/org/apache/commons/fileupload2/util/Streams.java
@@ -62,7 +62,8 @@ public final class Streams {
      * @return Number of bytes, which have been copied.
      * @throws IOException An I/O error occurred.
      */
-    public static long copy(final InputStream inputStream, final OutputStream 
outputStream, final boolean closeOutputStream)
+    public static long copy(final InputStream inputStream, final OutputStream 
outputStream,
+                            final boolean closeOutputStream)
             throws IOException {
         return copy(inputStream, outputStream, closeOutputStream, new 
byte[DEFAULT_BUFFER_SIZE]);
     }
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 ee0e13c..18d0609 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,7 +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>
+ * 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>
@@ -83,7 +84,8 @@ public final class RFC2231Utility {
      * <b>Eg 3.</b> {@code UTF-8''%c2%a3%20and%20%e2%82%ac%20rates}
      * 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
+     * @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 The requested character set wasn't 
found.
      */
diff --git 
a/src/test/java/org/apache/commons/fileupload2/FileItemHeadersTest.java 
b/src/test/java/org/apache/commons/fileupload2/FileItemHeadersTest.java
index 2e97f24..7832cd2 100644
--- a/src/test/java/org/apache/commons/fileupload2/FileItemHeadersTest.java
+++ b/src/test/java/org/apache/commons/fileupload2/FileItemHeadersTest.java
@@ -38,7 +38,8 @@ 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-Disposition",
+                "form-data; name=\"FileItem\"; filename=\"file1.txt\"");
         aMutableFileItemHeaders.addHeader("Content-Type", "text/plain");
 
         aMutableFileItemHeaders.addHeader("TestHeader", "headerValue1");
@@ -52,7 +53,8 @@ public class FileItemHeadersTest {
         assertEquals("testheader", headerNameEnumeration.next());
         assertFalse(headerNameEnumeration.hasNext());
 
-        assertEquals(aMutableFileItemHeaders.getHeader("Content-Disposition"), 
"form-data; name=\"FileItem\"; filename=\"file1.txt\"");
+        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");
diff --git a/src/test/java/org/apache/commons/fileupload2/FileUploadTest.java 
b/src/test/java/org/apache/commons/fileupload2/FileUploadTest.java
index eef8b39..bc26f25 100644
--- a/src/test/java/org/apache/commons/fileupload2/FileUploadTest.java
+++ b/src/test/java/org/apache/commons/fileupload2/FileUploadTest.java
@@ -58,7 +58,8 @@ public class FileUploadTest {
             throws IOException, FileUploadException {
         final List<FileItem> fileItems = Util.parseUpload(upload,
                                                "-----1234\r\n" +
-                                               "Content-Disposition: 
form-data; name=\"file\"; filename=\"foo.tab\"\r\n" +
+                                               "Content-Disposition: "
+                                               + "form-data; name=\"file\"; 
filename=\"foo.tab\"\r\n" +
                                                "Content-Type: 
text/whatever\r\n" +
                                                "\r\n" +
                                                "This is the content of the 
file\n" +
@@ -107,7 +108,8 @@ public class FileUploadTest {
             throws IOException, FileUploadException {
         final List<FileItem> fileItems = Util.parseUpload(upload,
                                                "-----1234\r\n" +
-                                               "Content-Disposition: 
form-data; name=\"FiLe\"; filename=\"FOO.tab\"\r\n" +
+                                               "Content-Disposition: 
form-data; "
+                                             + "name=\"FiLe\"; 
filename=\"FOO.tab\"\r\n" +
                                                "Content-Type: 
text/whatever\r\n" +
                                                "\r\n" +
                                                "This is the content of the 
file\n" +
@@ -221,7 +223,8 @@ public class FileUploadTest {
             "...contents of file2.gif...\r\n" +
             "--BbC04y--\r\n" +
             "--AaB03x--";
-        final List<FileItem> fileItems = Util.parseUpload(upload, 
request.getBytes(StandardCharsets.US_ASCII), contentType);
+        final List<FileItem> fileItems = Util.parseUpload(upload, 
request.getBytes(StandardCharsets.US_ASCII),
+                contentType);
         assertEquals(3, fileItems.size());
         final FileItem item0 = fileItems.get(0);
         assertEquals("field1", item0.getFieldName());
@@ -307,7 +310,8 @@ public class FileUploadTest {
         };
         final List<FileItem> fileItems = Util.parseUpload(upload,
                                                "-----1234\r\n" +
-                                               "Content-Disposition: 
form-data; name=\"file\"; filename=\"foo.tab\"\r\n" +
+                                               "Content-Disposition: 
form-data; name=\"file\"; "
+                                             + "filename=\"foo.tab\"\r\n" +
                                                "Content-Type: 
text/whatever\r\n" +
                                                headerNames[0] + ": " + 
headerValues[0] + "\r\n" +
                                                "\r\n" +
diff --git 
a/src/test/java/org/apache/commons/fileupload2/ParameterParserTest.java 
b/src/test/java/org/apache/commons/fileupload2/ParameterParserTest.java
index 4728457..4c4438e 100644
--- a/src/test/java/org/apache/commons/fileupload2/ParameterParserTest.java
+++ b/src/test/java/org/apache/commons/fileupload2/ParameterParserTest.java
@@ -113,7 +113,8 @@ public class ParameterParserTest {
     @Test
     public void testFileUpload199() {
         final ParameterParser parser = new ParameterParser();
-        final String s = "Content-Disposition: form-data; name=\"file\"; 
filename=\"=?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= 
=?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=\"\r\n";
+        final String s = "Content-Disposition: form-data; name=\"file\"; 
filename=\"=?ISO-8859-"
+                + "1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= 
=?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=\"\r\n";
         final Map<String, String> params = parser.parse(s, new char[] { ',', 
';' });
         assertEquals("If you can read this you understand the example.", 
params.get("filename"));
     }
@@ -127,7 +128,8 @@ public class ParameterParserTest {
         final ParameterParser parser = new ParameterParser();
 
         // Should parse a UTF-8 charset
-        String s = "Content-Disposition: form-data; name=\"file\"; 
filename*=UTF-8\'\'%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF\r\n";
+        String s = "Content-Disposition: form-data; "
+                + "name=\"file\"; 
filename*=UTF-8\'\'%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF\r\n";
         Map<String, String> params = parser.parse(s, new char[] { ',', ';' });
         assertEquals("\u3053\u3093\u306B\u3061\u306F", 
params.get("filename")); //filename = "こんにちは" in japanese
 
diff --git a/src/test/java/org/apache/commons/fileupload2/Util.java 
b/src/test/java/org/apache/commons/fileupload2/Util.java
index 95bc5b8..19b85fb 100644
--- a/src/test/java/org/apache/commons/fileupload2/Util.java
+++ b/src/test/java/org/apache/commons/fileupload2/Util.java
@@ -39,7 +39,8 @@ public class Util {
         return parseUpload(upload, bytes, Constants.CONTENT_TYPE);
     }
 
-    public static List<FileItem> parseUpload(final FileUpload upload, final 
byte[] bytes, final String contentType) throws FileUploadException {
+    public static List<FileItem> parseUpload(final FileUpload upload, final 
byte[] bytes, final String contentType)
+            throws FileUploadException {
         final HttpServletRequest request = new MockHttpServletRequest(bytes, 
contentType);
         return upload.parseRequest(new ServletRequestContext(request));
     }
diff --git 
a/src/test/java/org/apache/commons/fileupload2/portlet/MockPortletActionRequest.java
 
b/src/test/java/org/apache/commons/fileupload2/portlet/MockPortletActionRequest.java
index d7411e7..d390caf 100644
--- 
a/src/test/java/org/apache/commons/fileupload2/portlet/MockPortletActionRequest.java
+++ 
b/src/test/java/org/apache/commons/fileupload2/portlet/MockPortletActionRequest.java
@@ -61,7 +61,8 @@ public class MockPortletActionRequest implements 
ActionRequest {
         this(new ByteArrayInputStream(requestData), requestData.length, 
contentType);
     }
 
-    public MockPortletActionRequest(final ByteArrayInputStream 
byteArrayInputStream, final int requestLength, final String contentType) {
+    public MockPortletActionRequest(final ByteArrayInputStream 
byteArrayInputStream,
+                                    final int requestLength, final String 
contentType) {
         this.requestData = byteArrayInputStream;
         length = requestLength;
         this.contentType = contentType;
diff --git 
a/src/test/java/org/apache/commons/fileupload2/util/mime/Base64DecoderTestCase.java
 
b/src/test/java/org/apache/commons/fileupload2/util/mime/Base64DecoderTestCase.java
index 81908c6..9b395ec 100644
--- 
a/src/test/java/org/apache/commons/fileupload2/util/mime/Base64DecoderTestCase.java
+++ 
b/src/test/java/org/apache/commons/fileupload2/util/mime/Base64DecoderTestCase.java
@@ -150,7 +150,8 @@ public final class Base64DecoderTestCase {
         assertArrayEquals(expected, actual);
     }
 
-    private static void assertIOException(final String messageText, final 
String encoded) throws UnsupportedEncodingException {
+    private static void assertIOException(final String messageText, final 
String encoded)
+            throws UnsupportedEncodingException {
         final ByteArrayOutputStream out = new 
ByteArrayOutputStream(encoded.length());
         final byte[] encodedData = encoded.getBytes(StandardCharsets.US_ASCII);
         try {
diff --git 
a/src/test/java/org/apache/commons/fileupload2/util/mime/MimeUtilityTestCase.java
 
b/src/test/java/org/apache/commons/fileupload2/util/mime/MimeUtilityTestCase.java
index bf308fc..f4ae68d 100644
--- 
a/src/test/java/org/apache/commons/fileupload2/util/mime/MimeUtilityTestCase.java
+++ 
b/src/test/java/org/apache/commons/fileupload2/util/mime/MimeUtilityTestCase.java
@@ -49,13 +49,15 @@ public final class MimeUtilityTestCase {
     @Test
     public void decodeIso88591Base64Encoded() throws Exception {
         assertEncoded("If you can read this you understand the example.",
-                      "=?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= 
=?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=\"\r\n");
+                      "=?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= "
+                            + 
"=?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=\"\r\n");
     }
 
     @Test
     public void decodeIso88591Base64EncodedWithWhiteSpace() throws Exception {
         assertEncoded("If you can read this you understand the example.",
-                "=?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=\t  \r\n   
=?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=\"\r\n");
+                "=?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=\t  \r\n   
=?ISO-8859-"
+                      + "2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=\"\r\n");
     }
 
     private static void assertEncoded(final String expected, final String 
encoded) throws Exception {
diff --git 
a/src/test/java/org/apache/commons/fileupload2/util/mime/QuotedPrintableDecoderTestCase.java
 
b/src/test/java/org/apache/commons/fileupload2/util/mime/QuotedPrintableDecoderTestCase.java
index c17a03c..ffea1ba 100644
--- 
a/src/test/java/org/apache/commons/fileupload2/util/mime/QuotedPrintableDecoderTestCase.java
+++ 
b/src/test/java/org/apache/commons/fileupload2/util/mime/QuotedPrintableDecoderTestCase.java
@@ -80,8 +80,9 @@ public final class QuotedPrintableDecoderTestCase {
      */
     @Test
     public void softLineBreakDecode() throws Exception {
-        assertEncoded("If you believe that truth=beauty, then surely 
mathematics is the most beautiful branch of philosophy.",
-                      "If you believe that truth=3Dbeauty, then 
surely=20=\r\nmathematics is the most beautiful branch of philosophy.");
+        assertEncoded("If you believe that truth=beauty, then surely 
mathematics is the most "
+                        +  "beautiful branch of philosophy.", "If you believe 
that truth=3Dbeauty, then "
+                        + "surely=20=\r\nmathematics is the most beautiful 
branch of philosophy.");
     }
 
     @Test
@@ -110,7 +111,8 @@ public final class QuotedPrintableDecoderTestCase {
         assertArrayEquals(expected, actual);
     }
 
-    private static void assertIOException(final String messageText, final 
String encoded) throws UnsupportedEncodingException {
+    private static void assertIOException(final String messageText, final 
String encoded)
+            throws UnsupportedEncodingException {
         final ByteArrayOutputStream out = new 
ByteArrayOutputStream(encoded.length());
         final byte[] encodedData = encoded.getBytes(StandardCharsets.US_ASCII);
         try {
diff --git 
a/src/test/java/org/apache/commons/fileupload2/util/mime/RFC2231UtilityTestCase.java
 
b/src/test/java/org/apache/commons/fileupload2/util/mime/RFC2231UtilityTestCase.java
index bc55db3..3af9bff 100644
--- 
a/src/test/java/org/apache/commons/fileupload2/util/mime/RFC2231UtilityTestCase.java
+++ 
b/src/test/java/org/apache/commons/fileupload2/util/mime/RFC2231UtilityTestCase.java
@@ -28,7 +28,8 @@ import org.junit.jupiter.api.Test;
 /**
  * The expected characters are encoded in UTF16, while the actual characters 
may be encoded in UTF-8/ISO-8859-1
  *
- * RFC 5987 recommends to support both UTF-8 & ISO 8859-1. Test values are 
taken from https://tools.ietf.org/html/rfc5987#section-3.2.2
+ * RFC 5987 recommends to support both UTF-8 & ISO 8859-1. Test values are 
taken
+ * from https://tools.ietf.org/html/rfc5987#section-3.2.2
  */
 public final class RFC2231UtilityTestCase {
 
@@ -66,7 +67,8 @@ public final class RFC2231UtilityTestCase {
 
     @Test
     public void decodeUtf8() 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"
+        assertEncoded("\u00a3 \u0061\u006e\u0064 \u20ac 
\u0072\u0061\u0074\u0065\u0073",
+                "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates"); //"£ and € rates"
     }
 
     @Test

Reply via email to