Rename AbstractFileUpload.[get|set]SizeMax() to
AbstractFileUpload.[get|set]MaxSize()
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 90b3ec8..2412769 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 @@
/**
* 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 @@
}
/**
- * 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 @@
* 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 @@
}
/**
- * 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 @@
* 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 67bde79..3c47962 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 @@
/**
* 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 @@
/**
* 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 ca08912..03e272a 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 @@
*/
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 208893b..d9b2ae7 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 @@
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 @@
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 45a2594..6684dc0 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -47,6 +47,7 @@
<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 -->