Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/DefaultFileItem.java
===================================================================
diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313
--- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/DefaultFileItem.java (.../DefaultFileItem.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80)
+++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/DefaultFileItem.java (.../DefaultFileItem.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313)
@@ -32,8 +32,6 @@
* {@link #getInputStream()} and process the file without attempting to load
* it into memory, which may come handy with large files.
*
- * @version $Id$
- *
* @deprecated 1.1 Use DiskFileItem
instead.
*/
@Deprecated
@@ -43,11 +41,6 @@
// ----------------------------------------------------------- Constructors
/**
- * The UID to use when serializing this instance.
- */
- private static final long serialVersionUID = 4088572813833518255L;
-
- /**
* Constructs a new DefaultFileItem
instance.
*
* @param fieldName The name of the form field.
Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/DefaultFileItemFactory.java
===================================================================
diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313
--- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/DefaultFileItemFactory.java (.../DefaultFileItemFactory.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80)
+++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/DefaultFileItemFactory.java (.../DefaultFileItemFactory.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313)
@@ -28,16 +28,14 @@
* disk, is configurable, as is the directory in which temporary files will be
* created.
If not otherwise configured, the default configuration values are as * follows: *
System.getProperty("java.io.tmpdir")
.DiskFileItemFactory
instead.
*/
@Deprecated
Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/DiskFileUpload.java
===================================================================
diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313
--- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/DiskFileUpload.java (.../DiskFileUpload.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80)
+++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/DiskFileUpload.java (.../DiskFileUpload.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313)
@@ -34,8 +34,6 @@
* depending on their size, and will be available as {@link
* org.apache.commons.fileupload.FileItem}s.
*
- * @version $Id$
- *
* @deprecated 1.1 Use ServletFileUpload
together with
* DiskFileItemFactory
instead.
*/
Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileCountLimitExceededException.java
===================================================================
diff -u
--- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileCountLimitExceededException.java (revision 0)
+++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileCountLimitExceededException.java (revision 1d380e9e93fdd08acd43e3baa699e35779538313)
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+package org.apache.commons.fileupload;
+
+/**
+ * This exception is thrown if a request contains more files than the specified
+ * limit.
+ */
+public class FileCountLimitExceededException extends FileUploadException {
+
+ private static final long serialVersionUID = 6904179610227521789L;
+
+ /**
+ * The limit that was exceeded.
+ */
+ private final long limit;
+
+ /**
+ * Creates a new instance.
+ *
+ * @param message The detail message
+ * @param limit The limit that was exceeded
+ */
+ public FileCountLimitExceededException(final String message, final long limit) {
+ super(message);
+ this.limit = limit;
+ }
+
+ /**
+ * Retrieves the limit that was exceeded.
+ *
+ * @return The limit that was exceeded by the request
+ */
+ public long getLimit() {
+ return limit;
+ }
+}
Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItem.java
===================================================================
diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313
--- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItem.java (.../FileItem.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80)
+++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItem.java (.../FileItem.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313)
@@ -20,7 +20,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.io.Serializable;
import java.io.UnsupportedEncodingException;
/**
@@ -43,10 +42,9 @@
* implementation of this interface to also implement
* javax.activation.DataSource
with minimal additional work.
*
- * @version $Id$
* @since 1.3 additionally implements FileItemHeadersSupport
*/
-public interface FileItem extends Serializable, FileItemHeadersSupport {
+public interface FileItem extends FileItemHeadersSupport {
// ------------------------------- Methods from javax.activation.DataSource
Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemFactory.java
===================================================================
diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313
--- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemFactory.java (.../FileItemFactory.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80)
+++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemFactory.java (.../FileItemFactory.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313)
@@ -20,8 +20,6 @@
* A factory interface for creating {@link FileItem} instances. Factories * can provide their own custom configuration, over and above that provided * by the default file upload implementation.
- * - * @version $Id$ */ public interface FileItemFactory { Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemHeaders.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemHeaders.java (.../FileItemHeaders.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemHeaders.java (.../FileItemHeaders.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -24,8 +24,6 @@ * request. * * @since 1.2.1 - * - * @version $Id$ */ public interface FileItemHeaders { Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemHeadersSupport.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemHeadersSupport.java (.../FileItemHeadersSupport.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemHeadersSupport.java (.../FileItemHeadersSupport.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -24,8 +24,6 @@ * * @see FileItem * @see FileItemStream - * - * @version $Id$ */ public interface FileItemHeadersSupport { Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemIterator.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemIterator.java (.../FileItemIterator.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemIterator.java (.../FileItemIterator.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -21,8 +21,6 @@ /** * An iterator, as returned by * {@link FileUploadBase#getItemIterator(RequestContext)}. - * - * @version $Id$ */ public interface FileItemIterator { Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemStream.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemStream.java (.../FileItemStream.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileItemStream.java (.../FileItemStream.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -30,8 +30,6 @@ * its associated instances of {@link FileItemStream}: By invoking * {@link java.util.Iterator#hasNext()} on the iterator, you discard all data, * which hasn't been read so far from the previous data. - * - * @version $Id$ */ public interface FileItemStream extends FileItemHeadersSupport { @@ -42,7 +40,7 @@ * {@link java.util.Iterator#hasNext()} has been invoked on the * iterator, which created the {@link FileItemStream}. */ - public static class ItemSkippedException extends IOException { + class ItemSkippedException extends IOException { /** * The exceptions serial version UID, which is being used Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileUpload.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileUpload.java (.../FileUpload.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileUpload.java (.../FileUpload.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -29,8 +29,6 @@ *How the data for individual parts is stored is determined by the factory * used to create them; a given part may be in memory, on disk, or somewhere * else.
- * - * @version $Id$ */ public class FileUpload extends FileUploadBase { Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileUploadBase.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileUploadBase.java (.../FileUploadBase.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileUploadBase.java (.../FileUploadBase.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -38,6 +38,7 @@ import org.apache.commons.fileupload.util.FileItemHeadersImpl; import org.apache.commons.fileupload.util.LimitedInputStream; import org.apache.commons.fileupload.util.Streams; +import org.apache.commons.io.IOUtils; /** *High level API for processing file uploads.
@@ -52,8 +53,6 @@ *How the data for individual parts is stored is determined by the factory * used to create them; a given part may be in memory, on disk, or somewhere * else.
- * - * @version $Id$ */ public abstract class FileUploadBase { @@ -167,6 +166,12 @@ private long fileSizeMax = -1; /** + * The maximum permitted number of files that may be uploaded in a single + * request. A value of -1 indicates no maximum. + */ + private long fileCountMax = -1; + + /** * The content encoding to use when reading part headers. */ private String headerEncoding; @@ -243,6 +248,25 @@ } /** + * Returns the maximum number of files allowed in a single request. + * + * @return The maximum number of files allowed in a single request. + */ + public long getFileCountMax() { + return fileCountMax; + } + + /** + * Sets the maximum number of files allowed per request. + * + * @param fileCountMax The new limit. {@code -1} means no limit. + */ + public void setFileCountMax(final long fileCountMax) { + this.fileCountMax = fileCountMax; + } + + + /** * Retrieves the character encoding used when reading the headers of an * individual part. When not specified, ornull
, the request
* encoding is used. If that is also not specified, or null
,
@@ -333,18 +357,23 @@
try {
FileItemIterator iter = getItemIterator(ctx);
FileItemFactory fac = getFileItemFactory();
+ final byte[] buffer = new byte[Streams.DEFAULT_BUFFER_SIZE];
if (fac == null) {
throw new NullPointerException("No FileItemFactory has been set.");
}
while (iter.hasNext()) {
+ if (items.size() == fileCountMax) {
+ // The next item will exceed the limit.
+ throw new FileCountLimitExceededException(ATTACHMENT, getFileCountMax());
+ }
final FileItemStream item = iter.next();
// Don't use getName() here to prevent an InvalidFileNameException.
final String fileName = ((FileItemIteratorImpl.FileItemStreamImpl) item).name;
FileItem fileItem = fac.createItem(item.getFieldName(), item.getContentType(),
item.isFormField(), fileName);
items.add(fileItem);
try {
- Streams.copy(item.openStream(), fileItem.getOutputStream(), true);
+ Streams.copy(item.openStream(), fileItem.getOutputStream(), true, buffer);
} catch (FileUploadIOException e) {
throw (FileUploadException) e.getCause();
} catch (IOException e) {
@@ -365,8 +394,8 @@
for (FileItem fileItem : items) {
try {
fileItem.delete();
- } catch (Throwable e) {
- // ignore it
+ } catch (Exception ignored) {
+ // ignored TODO perhaps add to tracker delete failure list somehow?
}
}
}
@@ -765,20 +794,23 @@
fieldName = pFieldName;
contentType = pContentType;
formField = pFormField;
- final ItemInputStream itemStream = multi.newInputStream();
- InputStream istream = itemStream;
- if (fileSizeMax != -1) {
+ if (fileSizeMax != -1) { // Check if limit is already exceeded
if (pContentLength != -1
- && pContentLength > fileSizeMax) {
+ && pContentLength > fileSizeMax) {
FileSizeLimitExceededException e =
- new FileSizeLimitExceededException(
- format("The field %s exceeds its maximum permitted size of %s bytes.",
- fieldName, Long.valueOf(fileSizeMax)),
- pContentLength, fileSizeMax);
+ new FileSizeLimitExceededException(
+ format("The field %s exceeds its maximum permitted size of %s bytes.",
+ fieldName, Long.valueOf(fileSizeMax)),
+ pContentLength, fileSizeMax);
e.setFileName(pName);
e.setFieldName(pFieldName);
throw new FileUploadIOException(e);
}
+ }
+ // OK to construct stream now
+ final ItemInputStream itemStream = multi.newInputStream();
+ InputStream istream = itemStream;
+ if (fileSizeMax != -1) {
istream = new LimitedInputStream(istream, fileSizeMax) {
@Override
protected void raiseError(long pSizeMax, long pCount)
@@ -803,6 +835,7 @@
*
* @return Content type, if known, or null.
*/
+ @Override
public String getContentType() {
return contentType;
}
@@ -812,6 +845,7 @@
*
* @return Field name.
*/
+ @Override
public String getFieldName() {
return fieldName;
}
@@ -825,6 +859,7 @@
* use the file name anyways, catch the exception and use
* InvalidFileNameException#getName().
*/
+ @Override
public String getName() {
return Streams.checkFileName(name);
}
@@ -835,6 +870,7 @@
* @return True, if the item is a form field,
* otherwise false.
*/
+ @Override
public boolean isFormField() {
return formField;
}
@@ -846,6 +882,7 @@
* @return Opened input stream.
* @throws IOException An I/O error occurred.
*/
+ @Override
public InputStream openStream() throws IOException {
if (opened) {
throw new IllegalStateException(
@@ -871,6 +908,7 @@
*
* @return The items header object
*/
+ @Override
public FileItemHeaders getHeaders() {
return headers;
}
@@ -880,6 +918,7 @@
*
* @param pHeaders The items header object
*/
+ @Override
public void setHeaders(FileItemHeaders pHeaders) {
headers = pHeaders;
}
@@ -949,7 +988,6 @@
MULTIPART_FORM_DATA, MULTIPART_MIXED, contentType));
}
- InputStream input = ctx.getInputStream();
@SuppressWarnings("deprecation") // still has to be backward compatible
final int contentLengthInt = ctx.getContentLength();
@@ -960,14 +998,16 @@
: contentLengthInt;
// CHECKSTYLE:ON
+ InputStream input; // N.B. this is eventually closed in MultipartStream processing
if (sizeMax >= 0) {
if (requestSize != -1 && requestSize > sizeMax) {
throw new SizeLimitExceededException(
format("the request was rejected because its size (%s) exceeds the configured maximum (%s)",
Long.valueOf(requestSize), Long.valueOf(sizeMax)),
requestSize, sizeMax);
}
- input = new LimitedInputStream(input, sizeMax) {
+ // N.B. this is eventually closed in MultipartStream processing
+ input = new LimitedInputStream(ctx.getInputStream(), sizeMax) {
@Override
protected void raiseError(long pSizeMax, long pCount)
throws IOException {
@@ -978,6 +1018,8 @@
throw new FileUploadIOException(ex);
}
};
+ } else {
+ input = ctx.getInputStream();
}
String charEncoding = headerEncoding;
@@ -987,13 +1029,15 @@
boundary = getBoundary(contentType);
if (boundary == null) {
+ IOUtils.closeQuietly(input); // avoid possible resource leak
throw new FileUploadException("the request was rejected because no multipart boundary was found");
}
notifier = new MultipartStream.ProgressNotifier(listener, requestSize);
try {
multi = new MultipartStream(input, boundary, notifier);
} catch (IllegalArgumentException iae) {
+ IOUtils.closeQuietly(input); // avoid possible resource leak
throw new InvalidContentTypeException(
format("The boundary specified in the %s header is too long", CONTENT_TYPE), iae);
}
@@ -1095,6 +1139,7 @@
* @return True, if one or more additional file items
* are available, otherwise false.
*/
+ @Override
public boolean hasNext() throws FileUploadException, IOException {
if (eof) {
return false;
@@ -1121,6 +1166,7 @@
* @return FileItemStream instance, which provides
* access to the next file item.
*/
+ @Override
public FileItemStream next() throws FileUploadException, IOException {
if (eof || (!itemValid && !hasNext())) {
throw new NoSuchElementException();
@@ -1361,7 +1407,7 @@
/**
* @deprecated 1.2 Replaced by
- * {@code SizeLimitExceededException(String, long, long)}
+ * {@link #SizeLimitExceededException(String, long, long)}
*/
@Deprecated
public SizeLimitExceededException() {
@@ -1370,7 +1416,7 @@
/**
* @deprecated 1.2 Replaced by
- * {@code #SizeLimitExceededException(String, long, long)}
+ * {@link #SizeLimitExceededException(String, long, long)}
* @param message The exceptions detail message.
*/
@Deprecated
Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileUploadException.java
===================================================================
diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313
--- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileUploadException.java (.../FileUploadException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80)
+++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/FileUploadException.java (.../FileUploadException.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313)
@@ -21,8 +21,6 @@
/**
* Exception for errors encountered while processing the request.
- *
- * @version $Id$
*/
public class FileUploadException extends Exception {
Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/InvalidFileNameException.java
===================================================================
diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313
--- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/InvalidFileNameException.java (.../InvalidFileNameException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80)
+++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/InvalidFileNameException.java (.../InvalidFileNameException.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313)
@@ -25,8 +25,6 @@
* checks for the extension ".png"), while, depending on the underlying
* C library, it might create a file named "foo.exe", as the NUL
* character is the string terminator in C.
- *
- * @version $Id$
*/
public class InvalidFileNameException extends RuntimeException {
Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/MultipartStream.java
===================================================================
diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313
--- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/MultipartStream.java (.../MultipartStream.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80)
+++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/MultipartStream.java (.../MultipartStream.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313)
@@ -80,8 +80,6 @@
* // a read or write error occurred
* }
*
- *
- * @version $Id$
*/
public class MultipartStream {
@@ -222,14 +220,19 @@
* The amount of data, in bytes, that must be kept in the buffer in order
* to detect delimiters reliably.
*/
- private int keepRegion;
+ private final int keepRegion;
/**
* The byte sequence that partitions the stream.
*/
- private byte[] boundary;
+ private final byte[] boundary;
/**
+ * The table for Knuth-Morris-Pratt search algorithm.
+ */
+ private final int[] boundaryTable;
+
+ /**
* The length of the buffer used for processing the request.
*/
private final int bufSize;
@@ -339,12 +342,14 @@
this.notifier = pNotifier;
this.boundary = new byte[this.boundaryLength];
+ this.boundaryTable = new int[this.boundaryLength + 1];
this.keepRegion = this.boundary.length;
System.arraycopy(BOUNDARY_PREFIX, 0, this.boundary, 0,
BOUNDARY_PREFIX.length);
System.arraycopy(boundary, 0, this.boundary, BOUNDARY_PREFIX.length,
boundary.length);
+ computeBoundaryTable();
head = 0;
tail = 0;
@@ -502,13 +507,38 @@
throws IllegalBoundaryException {
if (boundary.length != boundaryLength - BOUNDARY_PREFIX.length) {
throw new IllegalBoundaryException(
- "The length of a boundary token can not be changed");
+ "The length of a boundary token cannot be changed");
}
System.arraycopy(boundary, 0, this.boundary, BOUNDARY_PREFIX.length,
boundary.length);
+ computeBoundaryTable();
}
/**
+ * Compute the table used for Knuth-Morris-Pratt search algorithm.
+ */
+ private void computeBoundaryTable() {
+ int position = 2;
+ int candidate = 0;
+
+ boundaryTable[0] = -1;
+ boundaryTable[1] = 0;
+
+ while (position <= boundaryLength) {
+ if (boundary[position - 1] == boundary[candidate]) {
+ boundaryTable[position] = candidate + 1;
+ candidate++;
+ position++;
+ } else if (candidate > 0) {
+ candidate = boundaryTable[candidate];
+ } else {
+ boundaryTable[position] = 0;
+ position++;
+ }
+ }
+ }
+
+ /**
* Reads the header-part
of the current
* encapsulation
.
*
@@ -589,8 +619,7 @@
*/
public int readBodyData(OutputStream output)
throws MalformedStreamException, IOException {
- final InputStream istream = newInputStream();
- return (int) Streams.copy(istream, output, false);
+ return (int) Streams.copy(newInputStream(), output, false); // N.B. Streams.copy closes the input stream
}
/**
@@ -629,6 +658,7 @@
// First delimiter may be not preceeded with a CRLF.
System.arraycopy(boundary, 2, boundary, 0, boundary.length - 2);
boundaryLength = boundary.length - 2;
+ computeBoundaryTable();
try {
// Discard all data up to the delimiter.
discardBodyData();
@@ -644,6 +674,7 @@
boundaryLength = boundary.length;
boundary[0] = CR;
boundary[1] = LF;
+ computeBoundaryTable();
}
}
@@ -699,23 +730,20 @@
* not found.
*/
protected int findSeparator() {
- int first;
- int match = 0;
- int maxpos = tail - boundaryLength;
- for (first = head; first <= maxpos && match != boundaryLength; first++) {
- first = findByte(boundary[0], first);
- if (first == -1 || first > maxpos) {
- return -1;
+
+ int bufferPos = this.head;
+ int tablePos = 0;
+
+ while (bufferPos < this.tail) {
+ while (tablePos >= 0 && buffer[bufferPos] != boundary[tablePos]) {
+ tablePos = boundaryTable[tablePos];
}
- for (match = 1; match < boundaryLength; match++) {
- if (buffer[first + match] != boundary[match]) {
- break;
- }
+ bufferPos++;
+ tablePos++;
+ if (tablePos == boundaryLength) {
+ return bufferPos - boundaryLength;
}
}
- if (match == boundaryLength) {
- return first - 1;
- }
return -1;
}
@@ -1023,6 +1051,7 @@
*
* @return True, if the stream is closed, otherwise false.
*/
+ @Override
public boolean isClosed() {
return closed;
}
Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/ParameterParser.java
===================================================================
diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313
--- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/ParameterParser.java (.../ParameterParser.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80)
+++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/ParameterParser.java (.../ParameterParser.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313)
@@ -33,8 +33,6 @@
*
* param1 = value; param2 = "anything goes; really"; param3
*
null
if
* not defined.
*/
+ @Override
public String getContentType() {
return contentType;
}
@@ -261,6 +248,7 @@
* use the file name anyways, catch the exception and use
* {@link org.apache.commons.fileupload.InvalidFileNameException#getName()}.
*/
+ @Override
public String getName() {
return Streams.checkFileName(fileName);
}
@@ -274,6 +262,7 @@
* @return true
if the file contents will be read
* from memory; false
otherwise.
*/
+ @Override
public boolean isInMemory() {
if (cachedContent != null) {
return true;
@@ -286,6 +275,7 @@
*
* @return The size of the file, in bytes.
*/
+ @Override
public long getSize() {
if (size >= 0) {
return size;
@@ -303,11 +293,13 @@
* contents of the file were not yet cached in memory, they will be
* loaded from the disk storage and cached.
*
- * @return The contents of the file as an array of bytes.
+ * @return The contents of the file as an array of bytes
+ * or {@code null} if the data cannot be read
*/
+ @Override
public byte[] get() {
if (isInMemory()) {
- if (cachedContent == null) {
+ if (cachedContent == null && dfos != null) {
cachedContent = dfos.getData();
}
return cachedContent;
@@ -317,18 +309,12 @@
InputStream fis = null;
try {
- fis = new BufferedInputStream(new FileInputStream(dfos.getFile()));
- fis.read(fileData);
+ fis = new FileInputStream(dfos.getFile());
+ IOUtils.readFully(fis, fileData);
} catch (IOException e) {
fileData = null;
} finally {
- if (fis != null) {
- try {
- fis.close();
- } catch (IOException e) {
- // ignore
- }
- }
+ IOUtils.closeQuietly(fis);
}
return fileData;
@@ -346,6 +332,7 @@
* @throws UnsupportedEncodingException if the requested character
* encoding is not available.
*/
+ @Override
public String getString(final String charset)
throws UnsupportedEncodingException {
return new String(get(), charset);
@@ -360,11 +347,12 @@
*
* @return The contents of the file, as a string.
*/
+ @Override
public String getString() {
byte[] rawdata = get();
String charset = getCharSet();
if (charset == null) {
- charset = DEFAULT_CHARSET;
+ charset = defaultCharset;
}
try {
return new String(rawdata, charset);
@@ -393,16 +381,16 @@
*
* @throws Exception if an error occurs.
*/
+ @Override
public void write(File file) throws Exception {
if (isInMemory()) {
FileOutputStream fout = null;
try {
fout = new FileOutputStream(file);
fout.write(get());
+ fout.close();
} finally {
- if (fout != null) {
- fout.close();
- }
+ IOUtils.closeQuietly(fout);
}
} else {
File outputFile = getStoreLocation();
@@ -414,32 +402,10 @@
* in a temporary location so move it to the
* desired file.
*/
- if (!outputFile.renameTo(file)) {
- BufferedInputStream in = null;
- BufferedOutputStream out = null;
- try {
- in = new BufferedInputStream(
- new FileInputStream(outputFile));
- out = new BufferedOutputStream(
- new FileOutputStream(file));
- IOUtils.copy(in, out);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- // ignore
- }
- }
- if (out != null) {
- try {
- out.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
+ if (file.exists()) {
+ file.delete();
}
+ FileUtils.moveFile(outputFile, file);
} else {
/*
* For whatever reason we cannot write the
@@ -458,10 +424,11 @@
* collected, this method can be used to ensure that this is done at an
* earlier time, thus preserving system resources.
*/
+ @Override
public void delete() {
cachedContent = null;
File outputFile = getStoreLocation();
- if (outputFile != null && outputFile.exists()) {
+ if (outputFile != null && !isInMemory() && outputFile.exists()) {
outputFile.delete();
}
}
@@ -475,6 +442,7 @@
* @see #setFieldName(java.lang.String)
*
*/
+ @Override
public String getFieldName() {
return fieldName;
}
@@ -487,6 +455,7 @@
* @see #getFieldName()
*
*/
+ @Override
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
@@ -501,6 +470,7 @@
* @see #setFormField(boolean)
*
*/
+ @Override
public boolean isFormField() {
return isFormField;
}
@@ -515,6 +485,7 @@
* @see #isFormField()
*
*/
+ @Override
public void setFormField(boolean state) {
isFormField = state;
}
@@ -524,10 +495,11 @@
* be used for storing the contents of the file.
*
* @return An {@link java.io.OutputStream OutputStream} that can be used
- * for storing the contensts of the file.
+ * for storing the contents of the file.
*
* @throws IOException if an error occurs.
*/
+ @Override
public OutputStream getOutputStream()
throws IOException {
if (dfos == null) {
@@ -556,6 +528,9 @@
if (dfos == null) {
return null;
}
+ if (isInMemory()) {
+ return null;
+ }
return dfos.getFile();
}
@@ -566,6 +541,9 @@
*/
@Override
protected void finalize() {
+ if (dfos == null || dfos.isInMemory()) {
+ return;
+ }
File outputFile = dfos.getFile();
if (outputFile != null && outputFile.exists()) {
@@ -578,6 +556,9 @@
* named temporary file in the configured repository path. The lifetime of
* the file is tied to the lifetime of the FileItem
instance;
* the file will be deleted when the instance is garbage collected.
+ * + * Note: Subclasses that override this method must ensure that they return the + * same File each time. * * @return The {@link java.io.File File} to be used for temporary storage. */ @@ -599,7 +580,7 @@ /** * Returns an identifier that is unique within the class loader used to - * load this class, but does not have random-like apearance. + * load this class, but does not have random-like appearance. * * @return A String with the non-random looking instance identifier. */ @@ -628,83 +609,11 @@ Boolean.valueOf(isFormField()), getFieldName()); } - // -------------------------------------------------- Serialization methods - /** - * Writes the state of this object during serialization. - * - * @param out The stream to which the state should be written. - * - * @throws IOException if an error occurs. - */ - private void writeObject(ObjectOutputStream out) throws IOException { - // Read the data - if (dfos.isInMemory()) { - cachedContent = get(); - } else { - cachedContent = null; - dfosFile = dfos.getFile(); - } - - // write out values - out.defaultWriteObject(); - } - - /** - * Reads the state of this object during deserialization. - * - * @param in The stream from which the state should be read. - * - * @throws IOException if an error occurs. - * @throws ClassNotFoundException if class cannot be found. - */ - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException { - if (!Boolean.getBoolean(SERIALIZABLE_PROPERTY)) { - throw new IllegalStateException("Property " + SERIALIZABLE_PROPERTY - + " is not true, rejecting to deserialize a DiskFileItem."); - } - // read values - in.defaultReadObject(); - - /* One expected use of serialization is to migrate HTTP sessions - * containing a DiskFileItem between JVMs. Particularly if the JVMs are - * on different machines It is possible that the repository location is - * not valid so validate it. - */ - if (repository != null) { - if (repository.isDirectory()) { - // Check path for nulls - if (repository.getPath().contains("\0")) { - throw new IOException(format( - "The repository [%s] contains a null character", - repository.getPath())); - } - } else { - throw new IOException(format( - "The repository [%s] is not a directory", - repository.getAbsolutePath())); - } - } - - OutputStream output = getOutputStream(); - if (cachedContent != null) { - output.write(cachedContent); - } else { - FileInputStream input = new FileInputStream(dfosFile); - IOUtils.copy(input, output); - dfosFile.delete(); - dfosFile = null; - } - output.close(); - - cachedContent = null; - } - - /** * Returns the file item headers. * @return The file items headers. */ + @Override public FileItemHeaders getHeaders() { return headers; } @@ -713,8 +622,26 @@ * Sets the file item headers. * @param pHeaders The file items headers. */ + @Override public void setHeaders(FileItemHeaders pHeaders) { headers = pHeaders; } + /** + * Returns the default charset for use when no explicit charset + * parameter is provided by the sender. + * @return the default charset + */ + public String getDefaultCharset() { + return defaultCharset; + } + + /** + * Sets the default charset for use when no explicit charset + * parameter is provided by the sender. + * @param charset the default charset + */ + public void setDefaultCharset(String charset) { + defaultCharset = charset; + } } Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/disk/DiskFileItemFactory.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/disk/DiskFileItemFactory.java (.../DiskFileItemFactory.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/disk/DiskFileItemFactory.java (.../DiskFileItemFactory.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -66,8 +66,6 @@ * in the users guide of commons-fileupload.
* * @since FileUpload 1.1 - * - * @version $Id$ */ public class DiskFileItemFactory implements FileItemFactory { @@ -97,6 +95,12 @@ */ private FileCleaningTracker fileCleaningTracker; + /** + * Default content charset to be used when no explicit charset + * parameter is provided by the sender. + */ + private String defaultCharset = DiskFileItem.DEFAULT_CHARSET; + // ----------------------------------------------------------- Constructors /** @@ -190,10 +194,12 @@ * * @return The newly created file item. */ + @Override public FileItem createItem(String fieldName, String contentType, boolean isFormField, String fileName) { DiskFileItem result = new DiskFileItem(fieldName, contentType, isFormField, fileName, sizeThreshold, repository); + result.setDefaultCharset(defaultCharset); FileCleaningTracker tracker = getFileCleaningTracker(); if (tracker != null) { tracker.track(result.getTempFile(), result); @@ -224,4 +230,21 @@ fileCleaningTracker = pTracker; } + /** + * Returns the default charset for use when no explicit charset + * parameter is provided by the sender. + * @return the default charset + */ + public String getDefaultCharset() { + return defaultCharset; + } + + /** + * Sets the default charset for use when no explicit charset + * parameter is provided by the sender. + * @param pCharset the default charset + */ + public void setDefaultCharset(String pCharset) { + defaultCharset = pCharset; + } } Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/portlet/PortletFileUpload.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/portlet/PortletFileUpload.java (.../PortletFileUpload.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/portlet/PortletFileUpload.java (.../PortletFileUpload.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -45,8 +45,6 @@ * else. * * @since FileUpload 1.1 - * - * @version $Id$ */ public class PortletFileUpload extends FileUpload { Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/portlet/PortletRequestContext.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/portlet/PortletRequestContext.java (.../PortletRequestContext.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/portlet/PortletRequestContext.java (.../PortletRequestContext.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -31,8 +31,6 @@ * a portlet. * * @since FileUpload 1.1 - * - * @version $Id$ */ public class PortletRequestContext implements UploadContext { @@ -63,6 +61,7 @@ * * @return The character encoding for the request. */ + @Override public String getCharacterEncoding() { return request.getCharacterEncoding(); } @@ -72,6 +71,7 @@ * * @return The content type of the request. */ + @Override public String getContentType() { return request.getContentType(); } @@ -82,6 +82,7 @@ * @return The content length of the request. * @deprecated 1.3 Use {@link #contentLength()} instead */ + @Override @Deprecated public int getContentLength() { return request.getContentLength(); @@ -93,6 +94,7 @@ * @return The content length of the request. * @since 1.3 */ + @Override public long contentLength() { long size; try { @@ -110,6 +112,7 @@ * * @throws IOException if a problem occurs. */ + @Override public InputStream getInputStream() throws IOException { return request.getPortletInputStream(); } Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/portlet/package-info.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/portlet/package-info.java (.../package-info.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/portlet/package-info.java (.../package-info.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -30,7 +30,7 @@ * The following code fragment demonstrates typical usage. * *- * DiskFileItemFactory factory = new DiskFileItemFactory(); + * DiskFileItemFactory factory = new DiskFileItemFactory(); * // Configure the factory here, if desired. * PortletFileUpload upload = new PortletFileUpload(factory); * // Configure the uploader here, if desired. Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/servlet/FileCleanerCleanup.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/servlet/FileCleanerCleanup.java (.../FileCleanerCleanup.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/servlet/FileCleanerCleanup.java (.../FileCleanerCleanup.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -26,8 +26,6 @@ * A servlet context listener, which ensures that the * {@link FileCleaningTracker}'s reaper thread is terminated, * when the web application is destroyed. - * - * @version $Id$ */ public class FileCleanerCleanup implements ServletContextListener { @@ -70,6 +68,7 @@ * @param sce The servlet context, used for calling * {@link #setFileCleaningTracker(ServletContext, FileCleaningTracker)}. */ + @Override public void contextInitialized(ServletContextEvent sce) { setFileCleaningTracker(sce.getServletContext(), new FileCleaningTracker()); @@ -82,6 +81,7 @@ * @param sce The servlet context, used for calling * {@link #getFileCleaningTracker(ServletContext)}. */ + @Override public void contextDestroyed(ServletContextEvent sce) { getFileCleaningTracker(sce.getServletContext()).exitWhenFinished(); } Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/servlet/ServletFileUpload.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/servlet/ServletFileUpload.java (.../ServletFileUpload.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/servlet/ServletFileUpload.java (.../ServletFileUpload.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -42,8 +42,6 @@ *How the data for individual parts is stored is determined by the factory * used to create them; a given part may be in memory, on disk, or somewhere * else.
- * - * @version $Id$ */ public class ServletFileUpload extends FileUpload { Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/servlet/ServletRequestContext.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/servlet/ServletRequestContext.java (.../ServletRequestContext.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/servlet/ServletRequestContext.java (.../ServletRequestContext.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -31,8 +31,6 @@ * an HTTP servlet. * * @since FileUpload 1.1 - * - * @version $Id$ */ public class ServletRequestContext implements UploadContext { @@ -61,6 +59,7 @@ * * @return The character encoding for the request. */ + @Override public String getCharacterEncoding() { return request.getCharacterEncoding(); } @@ -70,6 +69,7 @@ * * @return The content type of the request. */ + @Override public String getContentType() { return request.getContentType(); } @@ -80,6 +80,7 @@ * @return The content length of the request. * @deprecated 1.3 Use {@link #contentLength()} instead */ + @Override @Deprecated public int getContentLength() { return request.getContentLength(); @@ -91,6 +92,7 @@ * @return The content length of the request. * @since 1.3 */ + @Override public long contentLength() { long size; try { @@ -108,6 +110,7 @@ * * @throws IOException if a problem occurs. */ + @Override public InputStream getInputStream() throws IOException { return request.getInputStream(); } Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/Closeable.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/Closeable.java (.../Closeable.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/Closeable.java (.../Closeable.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -20,8 +20,6 @@ /** * Interface of an object, which may be closed. - * - * @version $Id$ */ public interface Closeable { Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/FileItemHeadersImpl.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/FileItemHeadersImpl.java (.../FileItemHeadersImpl.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/FileItemHeadersImpl.java (.../FileItemHeadersImpl.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -31,8 +31,6 @@ * Default implementation of the {@link FileItemHeaders} interface. * * @since 1.2.1 - * - * @version $Id$ */ public class FileItemHeadersImpl implements FileItemHeaders, Serializable { @@ -50,6 +48,7 @@ /** * {@inheritDoc} */ + @Override public String getHeader(String name) { String nameLower = name.toLowerCase(Locale.ENGLISH); ListheaderValueList = headerNameToValueListMap.get(nameLower); @@ -62,13 +61,15 @@ /** * {@inheritDoc} */ + @Override public Iterator getHeaderNames() { return headerNameToValueListMap.keySet().iterator(); } /** * {@inheritDoc} */ + @Override public Iterator getHeaders(String name) { String nameLower = name.toLowerCase(Locale.ENGLISH); List headerValueList = headerNameToValueListMap.get(nameLower); Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/LimitedInputStream.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/LimitedInputStream.java (.../LimitedInputStream.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/LimitedInputStream.java (.../LimitedInputStream.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -23,8 +23,6 @@ /** * An input stream, which limits its data size. This stream is * used, if the content length is unknown. - * - * @version $Id$ */ public abstract class LimitedInputStream extends FilterInputStream implements Closeable { @@ -93,7 +91,7 @@ * * @return the next byte of data, or -1
if the end of the * stream is reached. - * @exception IOException if an I/O error occurs. + * @throws IOException if an I/O error occurs. * @see java.io.FilterInputStream#in */ @Override @@ -122,11 +120,11 @@ * @return the total number of bytes read into the buffer, or *-1
if there is no more data because the end of * the stream has been reached. - * @exception NullPointerException Ifb
isnull
. - * @exception IndexOutOfBoundsException Ifoff
is negative, + * @throws NullPointerException Ifb
isnull
. + * @throws IndexOutOfBoundsException Ifoff
is negative, *len
is negative, orlen
is greater than *b.length - off
- * @exception IOException if an I/O error occurs. + * @throws IOException if an I/O error occurs. * @see java.io.FilterInputStream#in */ @Override @@ -145,6 +143,7 @@ * @return True, if the stream is closed, otherwise false. * @throws IOException An I/O error occurred. */ + @Override public boolean isClosed() throws IOException { return closed; } @@ -155,7 +154,7 @@ * This * method simply performsin.close()
. * - * @exception IOException if an I/O error occurs. + * @throws IOException if an I/O error occurs. * @see java.io.FilterInputStream#in */ @Override Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/Streams.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/Streams.java (.../Streams.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/Streams.java (.../Streams.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -26,8 +26,6 @@ /** * Utility class for working with streams. - * - * @version $Id$ */ public final class Streams { @@ -43,7 +41,7 @@ * Default buffer size for use in * {@link #copy(InputStream, OutputStream, boolean)}. */ - private static final int DEFAULT_BUFFER_SIZE = 8192; + public static final int DEFAULT_BUFFER_SIZE = 8192; /** * Copies the contents of the given {@link InputStream} Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/mime/Base64Decoder.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/mime/Base64Decoder.java (.../Base64Decoder.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/mime/Base64Decoder.java (.../Base64Decoder.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -104,8 +104,8 @@ * @throws IOException thrown when the padding is incorrect or the input is truncated. */ public static int decode(byte[] data, OutputStream out) throws IOException { - int outLen = 0; - byte [] cache = new byte[INPUT_BYTES_PER_CHUNK]; + int outLen = 0; + byte[] cache = new byte[INPUT_BYTES_PER_CHUNK]; int cachedBytes = 0; for (byte b : data) { Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/mime/MimeUtility.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/mime/MimeUtility.java (.../MimeUtility.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/mime/MimeUtility.java (.../MimeUtility.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -212,7 +212,7 @@ } // pull out the character set information (this is the MIME name at this point). - String charset = word.substring(2, charsetPos).toLowerCase(); + String charset = word.substring(2, charsetPos).toLowerCase(Locale.ENGLISH); // now pull out the encoding token the same way. int encodingPos = word.indexOf('?', charsetPos + 1); Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/mime/ParseException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/mime/ParseException.java (.../ParseException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/mime/ParseException.java (.../ParseException.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -31,7 +31,7 @@ * * @param message the detail message. */ - public ParseException(String message) { + ParseException(String message) { super(message); } Index: 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java (.../QuotedPrintableDecoder.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/commons-fileupload/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java (.../QuotedPrintableDecoder.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -44,7 +44,7 @@ * @param out The output stream used to return the decoded data. * * @return the number of bytes produced. - * @exception IOException + * @throws IOException */ public static int decode(byte[] data, OutputStream out) throws IOException { int off = 0; Index: 3rdParty_sources/reactor/reactor/adapter/JdkFlowAdapter.java =================================================================== diff -u -rc4ce08dc0aae7d9da822088a3d5710484f6b0402 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- 3rdParty_sources/reactor/reactor/adapter/JdkFlowAdapter.java (.../JdkFlowAdapter.java) (revision c4ce08dc0aae7d9da822088a3d5710484f6b0402) +++ 3rdParty_sources/reactor/reactor/adapter/JdkFlowAdapter.java (.../JdkFlowAdapter.java) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -57,9 +57,9 @@ } private static class FlowPublisherAsFluxextends Flux implements Scannable { - private final Flow.Publisher pub; + private final java.util.concurrent.Flow.Publisher pub; - private FlowPublisherAsFlux(Flow.Publisher pub) { + private FlowPublisherAsFlux(java.util.concurrent.Flow.Publisher pub) { this.pub = pub; } @@ -172,4 +172,4 @@ } JdkFlowAdapter(){} -} \ No newline at end of file +} Index: lams_build/lib/jakarta-commons/commons-fileupload-1.3.3.jar =================================================================== diff -u -r5661c79b661c18221c0eb5e32fe7ec54110e5a65 -r1d380e9e93fdd08acd43e3baa699e35779538313 Binary files differ Index: lams_build/lib/jakarta-commons/commons-fileupload-1.5.jar =================================================================== diff -u Binary files differ Index: lams_build/lib/jakarta-commons/fileupload.module.xml =================================================================== diff -u -r5661c79b661c18221c0eb5e32fe7ec54110e5a65 -r1d380e9e93fdd08acd43e3baa699e35779538313 --- lams_build/lib/jakarta-commons/fileupload.module.xml (.../fileupload.module.xml) (revision 5661c79b661c18221c0eb5e32fe7ec54110e5a65) +++ lams_build/lib/jakarta-commons/fileupload.module.xml (.../fileupload.module.xml) (revision 1d380e9e93fdd08acd43e3baa699e35779538313) @@ -24,7 +24,7 @@ - +