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 54a850b4427cd3bd4866557409c8bc7448005f31
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Apr 2 11:39:32 2023 -0400

    Remove deprecated fields, methods, and constructors
    
    - Constructors in MultipartStream
    - RequestContext.getContentLength()
    - JakSrvltRequestContext.getContentLength()
    - PortletRequestContext.getContentLength()
    - ServletRequestContext.getContentLength()
    - FileUploadBase.MAX_HEADER_SIZE
    - FileUploadBase.createItem(Map<String, String>, boolean)
    - FileUploadBase.getFieldName(Map<String, String>)
    - FileUploadBase.getFileName(Map<String, String>)
    - FileUploadBase.getHeader(Map<String, String>, String)
    - FileUploadBase.parseHeaders(String)
---
 src/changes/changes.xml                            |  12 +++
 .../apache/commons/fileupload2/FileUploadBase.java | 115 ---------------------
 .../commons/fileupload2/MultipartStream.java       |  43 +-------
 .../apache/commons/fileupload2/RequestContext.java |  15 +--
 .../jaksrvlt/JakSrvltRequestContext.java           |  12 ---
 .../fileupload2/portlet/PortletRequestContext.java |  20 ----
 .../fileupload2/servlet/ServletRequestContext.java |  12 ---
 7 files changed, 16 insertions(+), 213 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a5a7461..1c2cc94 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -59,6 +59,18 @@ 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>
       <action                        dev="markt" type="add">Add a configurable 
limit (disabled by default) for the number of files to upload per 
request.</action>
+      <!-- REMOVE -->
+      <action                        dev="ggregory" type="remove" due-to="Gary 
Gregory">Remove deprecated constructors in MultipartStream.</action>
+      <action                        dev="ggregory" type="remove" due-to="Gary 
Gregory">Remove deprecated RequestContext.getContentLength().</action>
+      <action                        dev="ggregory" type="remove" due-to="Gary 
Gregory">Remove deprecated JakSrvltRequestContext.getContentLength().</action>
+      <action                        dev="ggregory" type="remove" due-to="Gary 
Gregory">Remove deprecated PortletRequestContext.getContentLength().</action>
+      <action                        dev="ggregory" type="remove" due-to="Gary 
Gregory">Remove deprecated ServletRequestContext.getContentLength().</action>
+      <action                        dev="ggregory" type="remove" due-to="Gary 
Gregory">Remove deprecated FileUploadBase.MAX_HEADER_SIZE.</action>
+      <action                        dev="ggregory" type="remove" due-to="Gary 
Gregory">Remove deprecated FileUploadBase.createItem(Map, boolean).</action>
+      <action                        dev="ggregory" type="remove" due-to="Gary 
Gregory">Remove deprecated FileUploadBase.getFieldName(Map).</action>
+      <action                        dev="ggregory" type="remove" due-to="Gary 
Gregory">Remove deprecated FileUploadBase.getFileName(Map).</action>
+      <action                        dev="ggregory" type="remove" due-to="Gary 
Gregory">Remove deprecated FileUploadBase.getHeader(Map, String).</action>
+      <action                        dev="ggregory" type="remove" due-to="Gary 
Gregory">Remove deprecated FileUploadBase.parseHeaders(String).</action>
       <!-- UPDATE -->
       <action                        dev="ggregory" type="update" 
due-to="Dependabot, Gary Gregory">Bump actions/cache from 2.1.6 to 3.0.8 #128, 
#140.</action>
       <action                        dev="ggregory" type="update" 
due-to="Dependabot, Gary Gregory">Bump actions/checkout from 2.3.4 to 3.0.2 
#125.</action>
diff --git a/src/main/java/org/apache/commons/fileupload2/FileUploadBase.java 
b/src/main/java/org/apache/commons/fileupload2/FileUploadBase.java
index 193a0b8..58cb26f 100644
--- a/src/main/java/org/apache/commons/fileupload2/FileUploadBase.java
+++ b/src/main/java/org/apache/commons/fileupload2/FileUploadBase.java
@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -93,16 +92,6 @@ public abstract class FileUploadBase {
      */
     public static final String MULTIPART_MIXED = "multipart/mixed";
 
-    /**
-     * The maximum length of a single header line that will be parsed
-     * (1024 bytes).
-     * @deprecated This constant is no longer used. As of commons-fileupload
-     *   1.2, the only applicable limit is the total size of a parts headers,
-     *   {@link MultipartStream#HEADER_PART_SIZE_MAX}.
-     */
-    @Deprecated
-    public static final int MAX_HEADER_SIZE = 1024;
-
     /**
      * <p>Utility method that determines whether the request contains multipart
      * content.</p>
@@ -155,32 +144,6 @@ public abstract class FileUploadBase {
      */
     private ProgressListener listener;
 
-    // ----------------------------------------------------- Property accessors
-
-    /**
-     * Creates a new {@link FileItem} instance.
-     *
-     * @param headers       A {@code Map} containing the HTTP request
-     *                      headers.
-     * @param isFormField   Whether or not this item is a form field, as
-     *                      opposed to a file.
-     *
-     * @return A newly created {@code FileItem} instance.
-     *
-     * @throws FileUploadException if an error occurs.
-     * @deprecated 1.2 This method is no longer used in favour of
-     *   internally created instances of {@link FileItem}.
-     */
-    @Deprecated
-    protected FileItem createItem(final Map<String, String> headers,
-                                  final boolean isFormField)
-        throws FileUploadException {
-        return getFileItemFactory().createItem(getFieldName(headers),
-                getHeader(headers, CONTENT_TYPE),
-                isFormField,
-                getFileName(headers));
-    }
-
     /**
      * Retrieves the boundary from the {@code Content-type} header.
      *
@@ -216,20 +179,6 @@ public abstract class FileUploadBase {
         return getFieldName(headers.getHeader(CONTENT_DISPOSITION));
     }
 
-    /**
-     * Retrieves the field name from the {@code Content-disposition}
-     * header.
-     *
-     * @param headers A {@code Map} containing the HTTP request headers.
-     *
-     * @return The field name for the current {@code encapsulation}.
-     * @deprecated 1.2.1 Use {@link #getFieldName(FileItemHeaders)}.
-     */
-    @Deprecated
-    protected String getFieldName(final Map<String, String> headers) {
-        return getFieldName(getHeader(headers, CONTENT_DISPOSITION));
-    }
-
     /**
      * Returns the field name, which is given by the content-disposition
      * header.
@@ -280,20 +229,6 @@ public abstract class FileUploadBase {
         return getFileName(headers.getHeader(CONTENT_DISPOSITION));
     }
 
-    /**
-     * Retrieves the file name from the {@code Content-disposition}
-     * header.
-     *
-     * @param headers A {@code Map} containing the HTTP request headers.
-     *
-     * @return The file name for the current {@code encapsulation}.
-     * @deprecated 1.2.1 Use {@link #getFileName(FileItemHeaders)}.
-     */
-    @Deprecated
-    protected String getFileName(final Map<String, String> headers) {
-        return getFileName(getHeader(headers, CONTENT_DISPOSITION));
-    }
-
     /**
      * Returns the given content-disposition headers file name.
      * @param pContentDisposition The content-disposition headers value.
@@ -324,8 +259,6 @@ public abstract class FileUploadBase {
         return fileName;
     }
 
-    // --------------------------------------------------------- Public methods
-
     /**
      * Returns the maximum allowed size of a single uploaded file,
      * as opposed to {@link #getSizeMax()}.
@@ -337,23 +270,6 @@ public abstract class FileUploadBase {
         return fileSizeMax;
     }
 
-    /**
-     * Returns the header with the specified name from the supplied map. The
-     * header lookup is case-insensitive.
-     *
-     * @param headers A {@code Map} containing the HTTP request headers.
-     * @param name    The name of the header to return.
-     *
-     * @return The value of specified header, or a comma-separated list if
-     *         there were multiple headers of that name.
-     * @deprecated 1.2.1 Use {@link FileItemHeaders#getHeader(String)}.
-     */
-    @Deprecated
-    protected final String getHeader(final Map<String, String> headers,
-            final String name) {
-        return headers.get(name.toLowerCase(Locale.ENGLISH));
-    }
-
     /**
      * Retrieves the character encoding used when reading the headers of an
      * individual part. When not specified, or {@code null}, the request
@@ -366,8 +282,6 @@ public abstract class FileUploadBase {
         return headerEncoding;
     }
 
-    // ------------------------------------------------------ Protected methods
-
     /**
      * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt";>RFC 1867</a>
      * compliant {@code multipart/form-data} stream.
@@ -504,35 +418,6 @@ public abstract class FileUploadBase {
         headers.addHeader(headerName, headerValue);
     }
 
-    /**
-     * <p> Parses the {@code header-part} and returns as key/value
-     * pairs.
-     *
-     * <p> If there are multiple headers of the same names, the name
-     * will map to a comma-separated list containing the values.
-     *
-     * @param headerPart The {@code header-part} of the current
-     *                   {@code encapsulation}.
-     *
-     * @return A {@code Map} containing the parsed HTTP request headers.
-     * @deprecated 1.2.1 Use {@link #getParsedHeaders(String)}
-     */
-    @Deprecated
-    protected Map<String, String> parseHeaders(final String headerPart) {
-        final FileItemHeaders headers = getParsedHeaders(headerPart);
-        final Map<String, String> result = new HashMap<>();
-        for (final Iterator<String> iter = headers.getHeaderNames();  
iter.hasNext();) {
-            final String headerName = iter.next();
-            final Iterator<String> iter2 = headers.getHeaders(headerName);
-            final StringBuilder headerValue = new StringBuilder(iter2.next());
-            while (iter2.hasNext()) {
-                headerValue.append(",").append(iter2.next());
-            }
-            result.put(headerName, headerValue.toString());
-        }
-        return result;
-    }
-
     /**
      * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt";>RFC 1867</a>
      * compliant {@code multipart/form-data} stream.
diff --git a/src/main/java/org/apache/commons/fileupload2/MultipartStream.java 
b/src/main/java/org/apache/commons/fileupload2/MultipartStream.java
index b5168e1..61f8fab 100644
--- a/src/main/java/org/apache/commons/fileupload2/MultipartStream.java
+++ b/src/main/java/org/apache/commons/fileupload2/MultipartStream.java
@@ -570,50 +570,9 @@ public class MultipartStream {
      */
     private final ProgressNotifier notifier;
 
-    /**
-     * Creates a new instance.
-     *
-     * @deprecated 1.2.1 Use {@link #MultipartStream(InputStream, byte[], int, 
ProgressNotifier)}
-     */
-    @Deprecated
-    public MultipartStream() {
-        this(null, null, null);
-    }
-
-    // --------------------------------------------------------- Public methods
 
-    /**
-     * <p>
-     * Constructs a {@code MultipartStream} with a default size buffer.
-     *
-     * @param input    The {@code InputStream} to serve as a data source.
-     * @param boundary The token used for dividing the stream into {@code 
encapsulations}.
-     *
-     * @deprecated 1.2.1 Use {@link #MultipartStream(InputStream, byte[], int, 
ProgressNotifier)}.
-     */
-    @Deprecated
-    public MultipartStream(final InputStream input, final byte[] boundary) {
-        this(input, boundary, DEFAULT_BUFSIZE, null);
-    }
 
-    /**
-     * <p>
-     * Constructs a {@code MultipartStream} with a custom size buffer and no 
progress notifier.
-     *
-     * <p>
-     * Note that the buffer must be at least big enough to contain the 
boundary string, plus 4 characters for CR/LF and double dash, plus at least one 
byte of
-     * data. Too small a buffer size setting will degrade performance.
-     *
-     * @param input    The {@code InputStream} to serve as a data source.
-     * @param boundary The token used for dividing the stream into {@code 
encapsulations}.
-     * @param bufSize  The size of the buffer to be used, in bytes.
-     *
-     * @deprecated 1.2.1 Use {@link #MultipartStream(InputStream, byte[], int, 
ProgressNotifier)}.
-     */
-    @Deprecated
-    public MultipartStream(final InputStream input, final byte[] boundary, 
final int bufSize) {
-        this(input, boundary, bufSize, null);
-    }
+    // --------------------------------------------------------- Public methods
 
     /**
      * <p>
diff --git a/src/main/java/org/apache/commons/fileupload2/RequestContext.java 
b/src/main/java/org/apache/commons/fileupload2/RequestContext.java
index 9f4a8d1..8a0e501 100644
--- a/src/main/java/org/apache/commons/fileupload2/RequestContext.java
+++ b/src/main/java/org/apache/commons/fileupload2/RequestContext.java
@@ -29,30 +29,21 @@ import java.io.IOException;
 public interface RequestContext {
 
     /**
-     * Retrieve the character encoding for the request.
+     * Gets the character encoding for the request.
      *
      * @return The character encoding for the request.
      */
     String getCharacterEncoding();
 
     /**
-     * Retrieve the content length of the request.
-     *
-     * @return The content length of the request.
-     * @deprecated 1.3 Use {@link UploadContext#contentLength()} instead
-     */
-    @Deprecated
-    int getContentLength();
-
-    /**
-     * Retrieve the content type of the request.
+     * Gets the content type of the request.
      *
      * @return The content type of the request.
      */
     String getContentType();
 
     /**
-     * Retrieve the input stream for the request.
+     * Gets the input stream for the request.
      *
      * @return The input stream for the request.
      *
diff --git 
a/src/main/java/org/apache/commons/fileupload2/jaksrvlt/JakSrvltRequestContext.java
 
b/src/main/java/org/apache/commons/fileupload2/jaksrvlt/JakSrvltRequestContext.java
index b0ad720..4a84fc9 100644
--- 
a/src/main/java/org/apache/commons/fileupload2/jaksrvlt/JakSrvltRequestContext.java
+++ 
b/src/main/java/org/apache/commons/fileupload2/jaksrvlt/JakSrvltRequestContext.java
@@ -81,18 +81,6 @@ public class JakSrvltRequestContext implements UploadContext 
{
         return request.getCharacterEncoding();
     }
 
-    /**
-     * Retrieve the content length of the request.
-     *
-     * @return The content length of the request.
-     * @deprecated 1.3 Use {@link #contentLength()} instead
-     */
-    @Override
-    @Deprecated
-    public int getContentLength() {
-        return request.getContentLength();
-    }
-
     /**
      * Retrieve the content type of the request.
      *
diff --git 
a/src/main/java/org/apache/commons/fileupload2/portlet/PortletRequestContext.java
 
b/src/main/java/org/apache/commons/fileupload2/portlet/PortletRequestContext.java
index 796dfc5..eac6510 100644
--- 
a/src/main/java/org/apache/commons/fileupload2/portlet/PortletRequestContext.java
+++ 
b/src/main/java/org/apache/commons/fileupload2/portlet/PortletRequestContext.java
@@ -34,16 +34,11 @@ import org.apache.commons.fileupload2.UploadContext;
  */
 public class PortletRequestContext implements UploadContext {
 
-    // ----------------------------------------------------- Instance Variables
-
     /**
      * The request for which the context is being provided.
      */
     private final ActionRequest request;
 
-
-    // ----------------------------------------------------------- Constructors
-
     /**
      * Construct a context for this request.
      *
@@ -53,9 +48,6 @@ public class PortletRequestContext implements UploadContext {
         this.request = request;
     }
 
-
-    // --------------------------------------------------------- Public Methods
-
     /**
      * Retrieve the content length of the request.
      *
@@ -83,18 +75,6 @@ public class PortletRequestContext implements UploadContext {
         return request.getCharacterEncoding();
     }
 
-    /**
-     * Retrieve the content length of the request.
-     *
-     * @return The content length of the request.
-     * @deprecated 1.3 Use {@link #contentLength()} instead
-     */
-    @Override
-    @Deprecated
-    public int getContentLength() {
-        return request.getContentLength();
-    }
-
     /**
      * Retrieve the content type of the request.
      *
diff --git 
a/src/main/java/org/apache/commons/fileupload2/servlet/ServletRequestContext.java
 
b/src/main/java/org/apache/commons/fileupload2/servlet/ServletRequestContext.java
index 6919f49..6066294 100644
--- 
a/src/main/java/org/apache/commons/fileupload2/servlet/ServletRequestContext.java
+++ 
b/src/main/java/org/apache/commons/fileupload2/servlet/ServletRequestContext.java
@@ -81,18 +81,6 @@ public class ServletRequestContext implements UploadContext {
         return request.getCharacterEncoding();
     }
 
-    /**
-     * Retrieve the content length of the request.
-     *
-     * @return The content length of the request.
-     * @deprecated 1.3 Use {@link #contentLength()} instead
-     */
-    @Override
-    @Deprecated
-    public int getContentLength() {
-        return request.getContentLength();
-    }
-
     /**
      * Retrieve the content type of the request.
      *

Reply via email to