Skip to content
Permalink
Browse files
FILEUPLOAD-332 - Replace File Tab. Character with spaces
  • Loading branch information
arturobernalg committed May 7, 2021
1 parent ace4719 commit 1b165d173ba2ef245dd010e1e04aaa4f75473148
Showing 8 changed files with 179 additions and 179 deletions.
@@ -27,46 +27,46 @@
* {@link FileUploadBase#getItemIterator(RequestContext)}.
*/
public interface FileItemIterator {
/** Returns the maximum size of a single file. An {@link FileSizeLimitExceededException}
* will be thrown, if there is an uploaded file, which is exceeding this value.
* By default, this value will be copied from the {@link FileUploadBase#getFileSizeMax()
* FileUploadBase} object, however, the user may replace the default value with a
* request specific value by invoking {@link #setFileSizeMax(long)} on this object.
* @return The maximum size of a single, uploaded file. The value -1 indicates "unlimited".
*/
long getFileSizeMax();
/** Returns the maximum size of a single file. An {@link FileSizeLimitExceededException}
* will be thrown, if there is an uploaded file, which is exceeding this value.
* By default, this value will be copied from the {@link FileUploadBase#getFileSizeMax()
* FileUploadBase} object, however, the user may replace the default value with a
* request specific value by invoking {@link #setFileSizeMax(long)} on this object.
* @return The maximum size of a single, uploaded file. The value -1 indicates "unlimited".
*/
long getFileSizeMax();

/** Sets the maximum size of a single file. An {@link FileSizeLimitExceededException}
* will be thrown, if there is an uploaded file, which is exceeding this value.
* By default, this value will be copied from the {@link FileUploadBase#getFileSizeMax()
* FileUploadBase} object, however, the user may replace the default value with a
* request specific value by invoking {@link #setFileSizeMax(long)} on this object, so
* there is no need to configure it here.
* <em>Note:</em>Changing this value doesn't affect files, that have already been uploaded.
* @param pFileSizeMax The maximum size of a single, uploaded file. The value -1 indicates "unlimited".
*/
void setFileSizeMax(long pFileSizeMax);
/** Sets the maximum size of a single file. An {@link FileSizeLimitExceededException}
* will be thrown, if there is an uploaded file, which is exceeding this value.
* By default, this value will be copied from the {@link FileUploadBase#getFileSizeMax()
* FileUploadBase} object, however, the user may replace the default value with a
* request specific value by invoking {@link #setFileSizeMax(long)} on this object, so
* there is no need to configure it here.
* <em>Note:</em>Changing this value doesn't affect files, that have already been uploaded.
* @param pFileSizeMax The maximum size of a single, uploaded file. The value -1 indicates "unlimited".
*/
void setFileSizeMax(long pFileSizeMax);

/** Returns 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 FileUploadBase#getSizeMax()
* 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".
*/
long getSizeMax();
/** Returns 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 FileUploadBase#getSizeMax()
* 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".
*/
long getSizeMax();

/** Returns 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 FileUploadBase#getSizeMax()
* FileUploadBase} object, however, the user may replace the default value with a
* request specific value by invoking {@link #setSizeMax(long)} on this object.
* <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 {@link #hasNext()}, {@link #next()} have not
* yet been invoked.
* @param pSizeMax The maximum size of the complete HTTP request. The value -1 indicates "unlimited".
*/
void setSizeMax(long pSizeMax);
/** Returns 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 FileUploadBase#getSizeMax()
* FileUploadBase} object, however, the user may replace the default value with a
* request specific value by invoking {@link #setSizeMax(long)} on this object.
* <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 {@link #hasNext()}, {@link #next()} have not
* yet been invoked.
* @param pSizeMax The maximum size of the complete HTTP request. The value -1 indicates "unlimited".
*/
void setSizeMax(long pSizeMax);

/**
* Returns, whether another instance of {@link FileItemStream}
@@ -44,32 +44,32 @@
* {@link FileUploadBase#getItemIterator(RequestContext)}.
*/
public class FileItemIteratorImpl implements FileItemIterator {
private final FileUploadBase fileUploadBase;
private final RequestContext ctx;
private long sizeMax, fileSizeMax;
private final FileUploadBase fileUploadBase;
private final RequestContext ctx;
private long sizeMax, fileSizeMax;


@Override
public long getSizeMax() {
return sizeMax;
}
@Override
public long getSizeMax() {
return sizeMax;
}

@Override
public void setSizeMax(final long sizeMax) {
this.sizeMax = sizeMax;
}
@Override
public void setSizeMax(final long sizeMax) {
this.sizeMax = sizeMax;
}

@Override
public long getFileSizeMax() {
return fileSizeMax;
}
@Override
public long getFileSizeMax() {
return fileSizeMax;
}

@Override
public void setFileSizeMax(final long fileSizeMax) {
this.fileSizeMax = fileSizeMax;
}
@Override
public void setFileSizeMax(final long fileSizeMax) {
this.fileSizeMax = fileSizeMax;
}

/**
/**
* The multi part stream to process.
*/
private MultipartStream multiPartStream;
@@ -196,10 +196,10 @@ protected void raiseError(final long pSizeMax, final long pCount)
}

public MultipartStream getMultiPartStream() throws FileUploadException, IOException {
if (multiPartStream == null) {
init(fileUploadBase, ctx);
}
return multiPartStream;
if (multiPartStream == null) {
init(fileUploadBase, ctx);
}
return multiPartStream;
}

/**
@@ -331,15 +331,15 @@ public FileItemStream next() throws FileUploadException, IOException {
return currentItem;
}

@Override
public List<FileItem> getFileItems() throws FileUploadException, IOException {
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());
items.add(fi);
}
return items;
}
@Override
public List<FileItem> getFileItems() throws FileUploadException, IOException {
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());
items.add(fi);
}
return items;
}

}
@@ -35,7 +35,7 @@
* Default implementation of {@link FileItemStream}.
*/
public class FileItemStreamImpl implements FileItemStream {
private final FileItemIteratorImpl fileItemIteratorImpl;
private final FileItemIteratorImpl fileItemIteratorImpl;

/**
* The file items content type.
@@ -88,7 +88,7 @@ public class FileItemStreamImpl implements FileItemStream {
public FileItemStreamImpl(final FileItemIteratorImpl pFileItemIterator, final String pName, final String pFieldName,
final String pContentType, final boolean pFormField,
final long pContentLength) throws FileUploadException, IOException {
fileItemIteratorImpl = pFileItemIterator;
fileItemIteratorImpl = pFileItemIterator;
name = pName;
fieldName = pFieldName;
contentType = pContentType;
@@ -145,7 +145,7 @@ public static String asString(final InputStream inputStream) throws IOException
* @throws IOException An I/O error occurred.
*/
public static String asString(final InputStream inputStream, final String encoding)
throws IOException {
throws IOException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
copy(inputStream, baos, true);
return baos.toString(encoding);
@@ -76,16 +76,16 @@ public void testWithNullContentType() {
public void testMoveFile() throws Exception {
final DiskFileUpload myUpload = new DiskFileUpload();
myUpload.setSizeThreshold(0);
final String content =
final String content =
"-----1234\r\n" +
"Content-Disposition: form-data; name=\"file\";"
+ "filename=\"foo.tab\"\r\n" +
+ "filename=\"foo.tab\"\r\n" +
"Content-Type: text/whatever\r\n" +
"\r\n" +
"This is the content of the file\n" +
"\r\n" +
"-----1234--\r\n";
final byte[] contentBytes = content.getBytes(StandardCharsets.US_ASCII);
final byte[] contentBytes = content.getBytes(StandardCharsets.US_ASCII);
final HttpServletRequest request = new MockHttpServletRequest(contentBytes, Constants.CONTENT_TYPE);
final List<FileItem> items = myUpload.parseRequest(request);
assertNotNull(items);
@@ -82,7 +82,7 @@ public void parseParameterMap()

@Test
public void parseImpliedUtf8()
throws Exception {
throws Exception {
// utf8 encoded form-data without explicit content-type encoding
final String text = "-----1234\r\n" +
"Content-Disposition: form-data; name=\"utf8Html\"\r\n" +

0 comments on commit 1b165d1

Please sign in to comment.