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 74ca343e13ca9bb542152c65c45b5f6c45e1b7cf Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Tue Sep 9 07:50:59 2025 -0700 Rename AbstractFileUpload.[get|set]SizeMax() to AbstractFileUpload.[get|set]MaxSize() --- .../commons/fileupload2/core/AbstractFileUpload.java | 20 ++++++++++---------- .../fileupload2/core/FileItemInputIterator.java | 4 ++-- .../fileupload2/core/FileItemInputIteratorImpl.java | 2 +- .../commons/fileupload2/core/AbstractSizesTest.java | 4 ++-- src/changes/changes.xml | 1 + 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/AbstractFileUpload.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/AbstractFileUpload.java index 90b3ec86..2412769d 100644 --- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/AbstractFileUpload.java +++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/AbstractFileUpload.java @@ -122,10 +122,10 @@ public abstract class AbstractFileUpload<R, I extends FileItem<I>, F extends Fil /** * The maximum size permitted for the complete request, as opposed to {@link #fileSizeMax}. A value of -1 indicates no maximum. */ - private long sizeMax = -1; + private long maxSize = -1; /** - * The maximum size permitted for a single uploaded file, as opposed to {@link #sizeMax}. A value of -1 indicates no maximum. + * The maximum size permitted for a single uploaded file, as opposed to {@link #maxSize}. A value of -1 indicates no maximum. */ private long fileSizeMax = -1; @@ -267,7 +267,7 @@ public abstract class AbstractFileUpload<R, I extends FileItem<I>, F extends Fil } /** - * Gets the maximum allowed size of a single uploaded file, as opposed to {@link #getSizeMax()}. + * Gets the maximum allowed size of a single uploaded file, as opposed to {@link #getMaxSize()}. * * @see #setFileSizeMax(long) * @return Maximum size of a single uploaded file. @@ -376,10 +376,10 @@ public abstract class AbstractFileUpload<R, I extends FileItem<I>, F extends Fil * Gets the maximum allowed size of a complete request, as opposed to {@link #getFileSizeMax()}. * * @return The maximum allowed size, in bytes. The default value of -1 indicates, that there is no limit. - * @see #setSizeMax(long) + * @see #setMaxSize(long) */ - public long getSizeMax() { - return sizeMax; + public long getMaxSize() { + return maxSize; } /** @@ -545,7 +545,7 @@ public abstract class AbstractFileUpload<R, I extends FileItem<I>, F extends Fil } /** - * Sets the maximum allowed size of a single uploaded file, as opposed to {@link #getSizeMax()}. + * Sets the maximum allowed size of a single uploaded file, as opposed to {@link #getMaxSize()}. * * @see #getFileSizeMax() * @param fileSizeMax Maximum size of a single uploaded file. @@ -588,10 +588,10 @@ public abstract class AbstractFileUpload<R, I extends FileItem<I>, F extends Fil * Sets the maximum allowed size of a complete request, as opposed to {@link #setFileSizeMax(long)}. * * @param sizeMax The maximum allowed size, in bytes. The default value of -1 indicates, that there is no limit. - * @see #getSizeMax() + * @see #getMaxSize() */ - public void setSizeMax(final long sizeMax) { - this.sizeMax = sizeMax; + public void setMaxSize(final long sizeMax) { + this.maxSize = sizeMax; } } diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/FileItemInputIterator.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/FileItemInputIterator.java index 67bde79a..3c47962b 100644 --- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/FileItemInputIterator.java +++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/FileItemInputIterator.java @@ -38,7 +38,7 @@ public interface FileItemInputIterator extends IOIterator<FileItemInput> { /** * Gets the maximum size of the complete HTTP request. A {@link SizeLimitExceededException} will be thrown, if the HTTP request will exceed this value. By - * default, this value will be copied from the {@link AbstractFileUpload#getSizeMax() FileUploadBase} object, however, the user may replace the default + * default, this value will be copied from the {@link AbstractFileUpload#getMaxSize() FileUploadBase} object, however, the user may replace the default * value with a request specific value by invoking {@link #setSizeMax(long)} on this object. * * @return The maximum size of the complete HTTP request. The value -1 indicates "unlimited". @@ -81,7 +81,7 @@ public interface FileItemInputIterator extends IOIterator<FileItemInput> { /** * Sets the maximum size of the complete HTTP request. A {@link SizeLimitExceededException} will be thrown, if the HTTP request will exceed this value. By - * default, this value will be copied from the {@link AbstractFileUpload#getSizeMax() FileUploadBase} object, however, the user may replace the default + * default, this value will be copied from the {@link AbstractFileUpload#getMaxSize() FileUploadBase} object, however, the user may replace the default * value with a request specific value by invoking {@link #setSizeMax(long)} on this object. * <p> * <em>Note:</em> Setting the maximum size on this object will work only, if the iterator is not yet initialized. In other words: If the methods diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/FileItemInputIteratorImpl.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/FileItemInputIteratorImpl.java index ca089124..03e272af 100644 --- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/FileItemInputIteratorImpl.java +++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/FileItemInputIteratorImpl.java @@ -111,7 +111,7 @@ class FileItemInputIteratorImpl implements FileItemInputIterator { */ FileItemInputIteratorImpl(final AbstractFileUpload<?, ?, ?> fileUploadBase, final RequestContext requestContext) throws FileUploadException, IOException { this.fileUpload = fileUploadBase; - this.sizeMax = fileUploadBase.getSizeMax(); + this.sizeMax = fileUploadBase.getMaxSize(); this.fileSizeMax = fileUploadBase.getFileSizeMax(); this.requestContext = Objects.requireNonNull(requestContext, "requestContext"); this.multipartRelated = this.requestContext.isMultipartRelated(); diff --git a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractSizesTest.java b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractSizesTest.java index 208893bc..d9b2ae76 100644 --- a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractSizesTest.java +++ b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/AbstractSizesTest.java @@ -220,7 +220,7 @@ public abstract class AbstractSizesTest<AFU extends AbstractFileUpload<R, I, F>, final var upload = newFileUpload(); upload.setFileSizeMax(-1); - upload.setSizeMax(200); + upload.setMaxSize(200); final var req = newMockHttpServletRequest(request, null, null); try { @@ -253,7 +253,7 @@ public abstract class AbstractSizesTest<AFU extends AbstractFileUpload<R, I, F>, final var upload = newFileUpload(); upload.setFileSizeMax(-1); - upload.setSizeMax(300); + upload.setMaxSize(300); // the first item should be within the max size limit // set the read limit to 10 to simulate a "real" stream diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 45a25941..6684dc0c 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -47,6 +47,7 @@ The <action> type attribute can be add,update,fix,remove. <action issue="FILEUPLOAD-295" type="fix" dev="jochen">Clarified the precise meaning of isInMemory(), get(), getPath(), etc. in DiskFileItem</action> <action type="fix" dev="markt" due-to="Coverity Scan">Better exception type and message if a multipart/mixed part is presented without a boundary defined</action> <action type="fix" dev="ggregory" due-to="Gary Gregory">Rename MultipartInput.Builder.[get|set]PartHeaderSizeMax() to [get|set]MaxPartHeaderSize().</action> + <action type="fix" dev="ggregory" due-to="Gary Gregory">Rename AbstractFileUpload.[get|set]SizeMax() to AbstractFileUpload.[get|set]MaxSize().</action> <!-- ADD --> <action type="add" dev="ggregory" due-to="Ryan J Murphy">Add AbstractFileUpload support for a maximum part header size #429.</action> <!-- UPDATE -->