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 <[email protected]> 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; /**
