[maven-release-plugin] copy for tag FILEUPLOAD_1_3_RC1
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/fileupload/tags/FILEUPLOAD_1_3_RC1@1454697 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/doap_fileupload.rdf b/doap_fileupload.rdf
index 02d6475..7f95e82 100644
--- a/doap_fileupload.rdf
+++ b/doap_fileupload.rdf
@@ -40,7 +40,7 @@
<release>
<Version>
<name>commons-fileupload</name>
- <created>2013-02-11</created>
+ <created>2013-02-12</created>
<revision>1.3</revision>
</Version>
<Version>
diff --git a/pom.xml b/pom.xml
index 8652764..a7cda5f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -146,6 +146,22 @@
<name>frank</name>
<email>mailsurfie@gmail.com</email>
</contributor>
+ <contributor>
+ <name>Rafal Krzewski</name>
+ <email>Rafal.Krzewski@e-point.pl</email>
+ </contributor>
+ <contributor>
+ <name>Sean Legassick</name>
+ <email>sean@informage.net</email>
+ </contributor>
+ <contributor>
+ <name>Oleg Kalnichevski</name>
+ <email>oleg@ural.ru</email>
+ </contributor>
+ <contributor>
+ <name>David Sean Taylor</name>
+ <email>taylor@apache.org</email>
+ </contributor>
</contributors>
<scm>
@@ -274,18 +290,4 @@
</plugins>
</reporting>
- <profiles>
- <profile>
- <id>rc</id>
- <distributionManagement>
- <!-- Cannot define in parent ATM, see COMMONSSITE-26 -->
- <site>
- <id>apache.website</id>
- <name>Apache Commons Release Candidate Staging Site</name>
- <url>${commons.deployment.protocol}://people.apache.org/www/people.apache.org/builds/commons/${commons.componentid}/${commons.release.version}/${commons.rc.version}/site</url>
- </site>
- </distributionManagement>
- </profile>
- </profiles>
-
</project>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 6d33615..e6b0095 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -43,7 +43,7 @@
</properties>
<body>
- <release version="1.3" description="maintenance release, JDK1.5 update" date="2013-02-11">
+ <release version="1.3" description="maintenance release, JDK1.5 update" date="2013-02-12">
<!-- important notes -->
<action dev="markt" type="fix">
SECURITY - CVE-2013-0248. Update the Javadoc and documentation to make
diff --git a/src/main/assembly/src.xml b/src/main/assembly/src.xml
index c17990f..e1a799a 100755
--- a/src/main/assembly/src.xml
+++ b/src/main/assembly/src.xml
@@ -34,6 +34,7 @@
<exclude>**/bin/</exclude>
<exclude>**/.externalToolBuilders/</exclude>
<exclude>**/target/</exclude>
+ <exclude>**/download*.cgi</exclude>
</excludes>
</fileSet>
</fileSets>
diff --git a/src/main/java/org/apache/commons/fileupload/DefaultFileItem.java b/src/main/java/org/apache/commons/fileupload/DefaultFileItem.java
index feb9dab..c5e4c8c 100644
--- a/src/main/java/org/apache/commons/fileupload/DefaultFileItem.java
+++ b/src/main/java/org/apache/commons/fileupload/DefaultFileItem.java
@@ -32,13 +32,6 @@
* {@link #getInputStream()} and process the file without attempting to load
* it into memory, which may come handy with large files.
*
- * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
- * @author <a href="mailto:sean@informage.net">Sean Legassick</a>
- * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @author <a href="mailto:jmcnally@apache.org">John McNally</a>
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- * @author Sean C. Sullivan
- *
* @version $Id$
*
* @deprecated 1.1 Use <code>DiskFileItem</code> instead.
diff --git a/src/main/java/org/apache/commons/fileupload/DefaultFileItemFactory.java b/src/main/java/org/apache/commons/fileupload/DefaultFileItemFactory.java
index 57d47b4..04f880c 100644
--- a/src/main/java/org/apache/commons/fileupload/DefaultFileItemFactory.java
+++ b/src/main/java/org/apache/commons/fileupload/DefaultFileItemFactory.java
@@ -37,8 +37,6 @@
* </ul>
* </p>
*
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- *
* @version $Id$
*
* @deprecated 1.1 Use <code>DiskFileItemFactory</code> instead.
diff --git a/src/main/java/org/apache/commons/fileupload/DiskFileUpload.java b/src/main/java/org/apache/commons/fileupload/DiskFileUpload.java
index d2bdeec..3b4c212 100644
--- a/src/main/java/org/apache/commons/fileupload/DiskFileUpload.java
+++ b/src/main/java/org/apache/commons/fileupload/DiskFileUpload.java
@@ -34,13 +34,6 @@
* depending on their size, and will be available as {@link
* org.apache.commons.fileupload.FileItem}s.</p>
*
- * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
- * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
- * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- * @author Sean C. Sullivan
- *
* @version $Id$
*
* @deprecated 1.1 Use <code>ServletFileUpload</code> together with
diff --git a/src/main/java/org/apache/commons/fileupload/FileItem.java b/src/main/java/org/apache/commons/fileupload/FileItem.java
index 2d9dc1c..484719f 100644
--- a/src/main/java/org/apache/commons/fileupload/FileItem.java
+++ b/src/main/java/org/apache/commons/fileupload/FileItem.java
@@ -43,11 +43,6 @@
* implementation of this interface to also implement
* <code>javax.activation.DataSource</code> with minimal additional work.
*
- * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
- * @author <a href="mailto:sean@informage.net">Sean Legassick</a>
- * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- *
* @version $Id$
* @since 1.3 additionally implements FileItemHeadersSupport
*/
diff --git a/src/main/java/org/apache/commons/fileupload/FileItemFactory.java b/src/main/java/org/apache/commons/fileupload/FileItemFactory.java
index 2ca50f2..a576a33 100644
--- a/src/main/java/org/apache/commons/fileupload/FileItemFactory.java
+++ b/src/main/java/org/apache/commons/fileupload/FileItemFactory.java
@@ -21,8 +21,6 @@
* can provide their own custom configuration, over and above that provided
* by the default file upload implementation.</p>
*
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- *
* @version $Id$
*/
public interface FileItemFactory {
diff --git a/src/main/java/org/apache/commons/fileupload/FileItemHeaders.java b/src/main/java/org/apache/commons/fileupload/FileItemHeaders.java
index 202c552..8bdc04f 100644
--- a/src/main/java/org/apache/commons/fileupload/FileItemHeaders.java
+++ b/src/main/java/org/apache/commons/fileupload/FileItemHeaders.java
@@ -23,8 +23,9 @@
* item that was received within a <code>multipart/form-data</code> POST
* request.</p>
*
- * @author Michael C. Macaluso
* @since 1.2.1
+ *
+ * @version $Id$
*/
public interface FileItemHeaders {
diff --git a/src/main/java/org/apache/commons/fileupload/FileItemHeadersSupport.java b/src/main/java/org/apache/commons/fileupload/FileItemHeadersSupport.java
index 6e46193..af5d482 100644
--- a/src/main/java/org/apache/commons/fileupload/FileItemHeadersSupport.java
+++ b/src/main/java/org/apache/commons/fileupload/FileItemHeadersSupport.java
@@ -20,11 +20,12 @@
* Interface that will indicate that {@link FileItem} or {@link FileItemStream}
* implementations will accept the headers read for the item.
*
- * @author Michael C. Macaluso
* @since 1.2.1
*
* @see FileItem
* @see FileItemStream
+ *
+ * @version $Id$
*/
public interface FileItemHeadersSupport {
diff --git a/src/main/java/org/apache/commons/fileupload/FileItemIterator.java b/src/main/java/org/apache/commons/fileupload/FileItemIterator.java
index 63e36eb..6c4e628 100644
--- a/src/main/java/org/apache/commons/fileupload/FileItemIterator.java
+++ b/src/main/java/org/apache/commons/fileupload/FileItemIterator.java
@@ -21,6 +21,8 @@
/**
* An iterator, as returned by
* {@link FileUploadBase#getItemIterator(RequestContext)}.
+ *
+ * @version $Id$
*/
public interface FileItemIterator {
diff --git a/src/main/java/org/apache/commons/fileupload/FileItemStream.java b/src/main/java/org/apache/commons/fileupload/FileItemStream.java
index 1154945..fbb4abc 100644
--- a/src/main/java/org/apache/commons/fileupload/FileItemStream.java
+++ b/src/main/java/org/apache/commons/fileupload/FileItemStream.java
@@ -30,6 +30,8 @@
* 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.</p>
+ *
+ * @version $Id$
*/
public interface FileItemStream extends FileItemHeadersSupport {
diff --git a/src/main/java/org/apache/commons/fileupload/FileUpload.java b/src/main/java/org/apache/commons/fileupload/FileUpload.java
index 8e9b37a..d70cef5 100644
--- a/src/main/java/org/apache/commons/fileupload/FileUpload.java
+++ b/src/main/java/org/apache/commons/fileupload/FileUpload.java
@@ -30,13 +30,6 @@
* used to create them; a given part may be in memory, on disk, or somewhere
* else.</p>
*
- * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
- * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
- * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- * @author Sean C. Sullivan
- *
* @version $Id$
*/
public class FileUpload
diff --git a/src/main/java/org/apache/commons/fileupload/FileUploadBase.java b/src/main/java/org/apache/commons/fileupload/FileUploadBase.java
index 9fcc0bc..bb0e7dc 100644
--- a/src/main/java/org/apache/commons/fileupload/FileUploadBase.java
+++ b/src/main/java/org/apache/commons/fileupload/FileUploadBase.java
@@ -52,13 +52,6 @@
* used to create them; a given part may be in memory, on disk, or somewhere
* else.</p>
*
- * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
- * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
- * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- * @author Sean C. Sullivan
- *
* @version $Id$
*/
public abstract class FileUploadBase {
diff --git a/src/main/java/org/apache/commons/fileupload/FileUploadException.java b/src/main/java/org/apache/commons/fileupload/FileUploadException.java
index 874ccf3..1c66cb8 100644
--- a/src/main/java/org/apache/commons/fileupload/FileUploadException.java
+++ b/src/main/java/org/apache/commons/fileupload/FileUploadException.java
@@ -22,7 +22,6 @@
/**
* Exception for errors encountered while processing the request.
*
- * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
* @version $Id$
*/
public class FileUploadException extends Exception {
diff --git a/src/main/java/org/apache/commons/fileupload/InvalidFileNameException.java b/src/main/java/org/apache/commons/fileupload/InvalidFileNameException.java
index 8bdee38..e58f6e8 100644
--- a/src/main/java/org/apache/commons/fileupload/InvalidFileNameException.java
+++ b/src/main/java/org/apache/commons/fileupload/InvalidFileNameException.java
@@ -25,6 +25,8 @@
* 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 {
diff --git a/src/main/java/org/apache/commons/fileupload/MultipartStream.java b/src/main/java/org/apache/commons/fileupload/MultipartStream.java
index d85eb1c..cc1c18e 100644
--- a/src/main/java/org/apache/commons/fileupload/MultipartStream.java
+++ b/src/main/java/org/apache/commons/fileupload/MultipartStream.java
@@ -80,10 +80,6 @@
* }
* </pre>
*
- * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- * @author Sean C. Sullivan
- *
* @version $Id$
*/
public class MultipartStream {
diff --git a/src/main/java/org/apache/commons/fileupload/ParameterParser.java b/src/main/java/org/apache/commons/fileupload/ParameterParser.java
index f50d4b9..ca43a68 100644
--- a/src/main/java/org/apache/commons/fileupload/ParameterParser.java
+++ b/src/main/java/org/apache/commons/fileupload/ParameterParser.java
@@ -30,7 +30,7 @@
* <code>param1 = value; param2 = "anything goes; really"; param3</code>
* </p>
*
- * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
+ * @version $Id$
*/
public class ParameterParser {
diff --git a/src/main/java/org/apache/commons/fileupload/ProgressListener.java b/src/main/java/org/apache/commons/fileupload/ProgressListener.java
index 5a869ef..30d7209 100644
--- a/src/main/java/org/apache/commons/fileupload/ProgressListener.java
+++ b/src/main/java/org/apache/commons/fileupload/ProgressListener.java
@@ -19,6 +19,8 @@
/**
* The {@link ProgressListener} may be used to display a progress bar
* or do stuff like that.
+ *
+ * @version $Id$
*/
public interface ProgressListener {
diff --git a/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java b/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java
index a649e1a..d0ada99 100644
--- a/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java
+++ b/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java
@@ -69,13 +69,6 @@
* your web application ends. See the section on "Resource cleanup"
* in the users guide of commons-fileupload.</p>
*
- * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
- * @author <a href="mailto:sean@informage.net">Sean Legassick</a>
- * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @author <a href="mailto:jmcnally@apache.org">John McNally</a>
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- * @author Sean C. Sullivan
- *
* @since FileUpload 1.1
*
* @version $Id$
diff --git a/src/main/java/org/apache/commons/fileupload/disk/DiskFileItemFactory.java b/src/main/java/org/apache/commons/fileupload/disk/DiskFileItemFactory.java
index 0cf0dab..8c3676c 100644
--- a/src/main/java/org/apache/commons/fileupload/disk/DiskFileItemFactory.java
+++ b/src/main/java/org/apache/commons/fileupload/disk/DiskFileItemFactory.java
@@ -65,8 +65,6 @@
* your web application ends. See the section on "Resource cleanup"
* in the users guide of commons-fileupload.</p>
*
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- *
* @since FileUpload 1.1
*
* @version $Id$
diff --git a/src/main/java/org/apache/commons/fileupload/portlet/PortletFileUpload.java b/src/main/java/org/apache/commons/fileupload/portlet/PortletFileUpload.java
index 1d4e50d..36b06b4 100644
--- a/src/main/java/org/apache/commons/fileupload/portlet/PortletFileUpload.java
+++ b/src/main/java/org/apache/commons/fileupload/portlet/PortletFileUpload.java
@@ -43,13 +43,6 @@
* used to create them; a given part may be in memory, on disk, or somewhere
* else.</p>
*
- * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
- * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
- * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- * @author Sean C. Sullivan
- *
* @since FileUpload 1.1
*
* @version $Id$
diff --git a/src/main/java/org/apache/commons/fileupload/portlet/PortletRequestContext.java b/src/main/java/org/apache/commons/fileupload/portlet/PortletRequestContext.java
index 3f19d88..23d298b 100644
--- a/src/main/java/org/apache/commons/fileupload/portlet/PortletRequestContext.java
+++ b/src/main/java/org/apache/commons/fileupload/portlet/PortletRequestContext.java
@@ -29,8 +29,6 @@
* <p>Provides access to the request information needed for a request made to
* a portlet.</p>
*
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- *
* @since FileUpload 1.1
*
* @version $Id$
diff --git a/src/main/java/org/apache/commons/fileupload/servlet/FileCleanerCleanup.java b/src/main/java/org/apache/commons/fileupload/servlet/FileCleanerCleanup.java
index 85dcd89..d55ccc5 100644
--- a/src/main/java/org/apache/commons/fileupload/servlet/FileCleanerCleanup.java
+++ b/src/main/java/org/apache/commons/fileupload/servlet/FileCleanerCleanup.java
@@ -27,6 +27,8 @@
* {@link org.apache.commons.io.FileCleaner FileCleaner's}
* reaper thread is terminated,
* when the web application is destroyed.
+ *
+ * @version $Id$
*/
public class FileCleanerCleanup implements ServletContextListener {
diff --git a/src/main/java/org/apache/commons/fileupload/servlet/ServletFileUpload.java b/src/main/java/org/apache/commons/fileupload/servlet/ServletFileUpload.java
index 649a9dd..cd0cafd 100644
--- a/src/main/java/org/apache/commons/fileupload/servlet/ServletFileUpload.java
+++ b/src/main/java/org/apache/commons/fileupload/servlet/ServletFileUpload.java
@@ -41,13 +41,6 @@
* used to create them; a given part may be in memory, on disk, or somewhere
* else.</p>
*
- * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
- * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
- * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- * @author Sean C. Sullivan
- *
* @version $Id$
*/
public class ServletFileUpload extends FileUpload {
diff --git a/src/main/java/org/apache/commons/fileupload/servlet/ServletRequestContext.java b/src/main/java/org/apache/commons/fileupload/servlet/ServletRequestContext.java
index 200ad89..cb738f2 100644
--- a/src/main/java/org/apache/commons/fileupload/servlet/ServletRequestContext.java
+++ b/src/main/java/org/apache/commons/fileupload/servlet/ServletRequestContext.java
@@ -30,8 +30,6 @@
* <p>Provides access to the request information needed for a request made to
* an HTTP servlet.</p>
*
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- *
* @since FileUpload 1.1
*
* @version $Id$
diff --git a/src/main/java/org/apache/commons/fileupload/util/Closeable.java b/src/main/java/org/apache/commons/fileupload/util/Closeable.java
index 741ccea..dcef1ca 100644
--- a/src/main/java/org/apache/commons/fileupload/util/Closeable.java
+++ b/src/main/java/org/apache/commons/fileupload/util/Closeable.java
@@ -20,6 +20,8 @@
/**
* Interface of an object, which may be closed.
+ *
+ * @version $Id$
*/
public interface Closeable {
diff --git a/src/main/java/org/apache/commons/fileupload/util/FileItemHeadersImpl.java b/src/main/java/org/apache/commons/fileupload/util/FileItemHeadersImpl.java
index bd89834..11c6020 100644
--- a/src/main/java/org/apache/commons/fileupload/util/FileItemHeadersImpl.java
+++ b/src/main/java/org/apache/commons/fileupload/util/FileItemHeadersImpl.java
@@ -29,8 +29,9 @@
/**
* Default implementation of the {@link FileItemHeaders} interface.
*
- * @author Michael C. Macaluso
* @since 1.2.1
+ *
+ * @version $Id$
*/
public class FileItemHeadersImpl implements FileItemHeaders, Serializable {
diff --git a/src/main/java/org/apache/commons/fileupload/util/LimitedInputStream.java b/src/main/java/org/apache/commons/fileupload/util/LimitedInputStream.java
index e11eba2..ea23357 100644
--- a/src/main/java/org/apache/commons/fileupload/util/LimitedInputStream.java
+++ b/src/main/java/org/apache/commons/fileupload/util/LimitedInputStream.java
@@ -23,6 +23,8 @@
/**
* 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 {
diff --git a/src/main/java/org/apache/commons/fileupload/util/Streams.java b/src/main/java/org/apache/commons/fileupload/util/Streams.java
index 6d373f0..ed8b08c 100644
--- a/src/main/java/org/apache/commons/fileupload/util/Streams.java
+++ b/src/main/java/org/apache/commons/fileupload/util/Streams.java
@@ -25,6 +25,8 @@
/**
* Utility class for working with streams.
+ *
+ * @version $Id$
*/
public final class Streams {
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index 98f8ec8..333898a 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -63,7 +63,7 @@
<section name="Downloading">
<subsection name="Full Releases">
- <p><strong>FileUpload 1.3</strong> - 11 March 2013</p>
+ <p><strong>FileUpload 1.3</strong> - 12 March 2013</p>
<ul>
<li>Download the binary and source distributions from a mirror site
<a href="http://commons.apache.org/fileupload/download_fileupload.cgi">here</a>
diff --git a/src/test/java/org/apache/commons/fileupload/DefaultFileItemTest.java b/src/test/java/org/apache/commons/fileupload/DefaultFileItemTest.java
index 35a4ecb..f6b3174 100644
--- a/src/test/java/org/apache/commons/fileupload/DefaultFileItemTest.java
+++ b/src/test/java/org/apache/commons/fileupload/DefaultFileItemTest.java
@@ -30,15 +30,13 @@
import org.junit.Test;
-@SuppressWarnings("deprecation") // unit tests for deprecated class
-
/**
* Unit tests for {@link org.apache.commons.fileupload.DefaultFileItem}.
*
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
+ * @version $Id$
*/
-public class DefaultFileItemTest
- {
+@SuppressWarnings("deprecation") // unit tests for deprecated class
+public class DefaultFileItemTest {
/**
* Content type for regular form items.
@@ -59,8 +57,7 @@
* Test construction of a regular text field.
*/
@Test
- public void testTextFieldConstruction()
- {
+ public void testTextFieldConstruction() {
FileItemFactory factory = createFactory(null);
String textFieldName = "textField";
@@ -81,8 +78,7 @@
* Test construction of a file field.
*/
@Test
- public void testFileFieldConstruction()
- {
+ public void testFileFieldConstruction() {
FileItemFactory factory = createFactory(null);
String fileFieldName = "fileField";
String fileName = "originalFileName";
@@ -105,8 +101,7 @@
* configured threshold.
*/
@Test
- public void testBelowThreshold()
- {
+ public void testBelowThreshold() {
FileItemFactory factory = createFactory(null);
String textFieldName = "textField";
String textFieldValue = "0123456789";
@@ -120,14 +115,11 @@
);
assertNotNull(item);
- try
- {
+ try {
OutputStream os = item.getOutputStream();
os.write(testFieldValueBytes);
os.close();
- }
- catch(IOException e)
- {
+ } catch(IOException e) {
fail("Unexpected IOException");
}
assertTrue(item.isInMemory());
@@ -141,8 +133,7 @@
* configured threshold, where no specific repository is configured.
*/
@Test
- public void testAboveThresholdDefaultRepository()
- {
+ public void testAboveThresholdDefaultRepository() {
doTestAboveThreshold(null);
}
@@ -151,8 +142,7 @@
* configured threshold, where a specific repository is configured.
*/
@Test
- public void testAboveThresholdSpecifiedRepository()
- {
+ public void testAboveThresholdSpecifiedRepository() {
String tempPath = System.getProperty("java.io.tmpdir");
String tempDirName = "testAboveThresholdSpecifiedRepository";
File tempDir = new File(tempPath, tempDirName);
@@ -169,8 +159,7 @@
* @param repository The directory within which temporary files will be
* created.
*/
- public void doTestAboveThreshold(File repository)
- {
+ public void doTestAboveThreshold(File repository) {
FileItemFactory factory = createFactory(repository);
String textFieldName = "textField";
String textFieldValue = "01234567890123456789";
@@ -184,14 +173,11 @@
);
assertNotNull(item);
- try
- {
+ try {
OutputStream os = item.getOutputStream();
os.write(testFieldValueBytes);
os.close();
- }
- catch(IOException e)
- {
+ } catch(IOException e) {
fail("Unexpected IOException");
}
assertFalse(item.isInMemory());
@@ -206,8 +192,7 @@
assertTrue(storeLocation.exists());
assertEquals(storeLocation.length(), testFieldValueBytes.length);
- if (repository != null)
- {
+ if (repository != null) {
assertEquals(storeLocation.getParentFile(), repository);
}
@@ -223,67 +208,58 @@
* created.
* @return the new <code>FileItemFactory</code> instance.
*/
- protected FileItemFactory createFactory(File repository)
- {
+ protected FileItemFactory createFactory(File repository) {
return new DefaultFileItemFactory(threshold, repository);
}
-
static final String CHARSET_ISO88591 = "ISO-8859-1";
+
static final String CHARSET_ASCII = "US-ASCII";
+
static final String CHARSET_UTF8 = "UTF-8";
+
static final String CHARSET_KOI8_R = "KOI8_R";
+
static final String CHARSET_WIN1251 = "Cp1251";
- static final int SWISS_GERMAN_STUFF_UNICODE [] =
- {
+ static final int SWISS_GERMAN_STUFF_UNICODE [] = {
0x47, 0x72, 0xFC, 0x65, 0x7A, 0x69, 0x5F, 0x7A, 0xE4, 0x6D, 0xE4
};
- static final int SWISS_GERMAN_STUFF_ISO8859_1 [] =
- {
+ static final int SWISS_GERMAN_STUFF_ISO8859_1 [] = {
0x47, 0x72, 0xFC, 0x65, 0x7A, 0x69, 0x5F, 0x7A, 0xE4, 0x6D, 0xE4
};
- static final int SWISS_GERMAN_STUFF_UTF8 [] =
- {
+ static final int SWISS_GERMAN_STUFF_UTF8 [] = {
0x47, 0x72, 0xC3, 0xBC, 0x65, 0x7A, 0x69, 0x5F, 0x7A, 0xC3, 0xA4,
0x6D, 0xC3, 0xA4
};
- static final int RUSSIAN_STUFF_UNICODE [] =
- {
+ static final int RUSSIAN_STUFF_UNICODE [] = {
0x412, 0x441, 0x435, 0x43C, 0x5F, 0x43F, 0x440, 0x438,
0x432, 0x435, 0x442
};
- static final int RUSSIAN_STUFF_UTF8 [] =
- {
+ static final int RUSSIAN_STUFF_UTF8 [] = {
0xD0, 0x92, 0xD1, 0x81, 0xD0, 0xB5, 0xD0, 0xBC, 0x5F,
0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0,
0xB5, 0xD1, 0x82
};
- static final int RUSSIAN_STUFF_KOI8R [] =
- {
+ static final int RUSSIAN_STUFF_KOI8R [] = {
0xF7, 0xD3, 0xC5, 0xCD, 0x5F, 0xD0, 0xD2, 0xC9, 0xD7,
0xC5, 0xD4
};
- static final int RUSSIAN_STUFF_WIN1251 [] =
- {
+ static final int RUSSIAN_STUFF_WIN1251 [] = {
0xC2, 0xF1, 0xE5, 0xEC, 0x5F, 0xEF, 0xF0, 0xE8, 0xE2,
0xE5, 0xF2
};
-
- private static String constructString(int[] unicodeChars)
- {
+ private static String constructString(int[] unicodeChars) {
StringBuffer buffer = new StringBuffer();
- if (unicodeChars != null)
- {
- for (int i = 0; i < unicodeChars.length; i++)
- {
+ if (unicodeChars != null) {
+ for (int i = 0; i < unicodeChars.length; i++) {
buffer.append((char) unicodeChars[i]);
}
}
@@ -293,8 +269,7 @@
/**
* Test construction of content charset.
*/
- public void testContentCharSet() throws Exception
- {
+ public void testContentCharSet() throws Exception {
FileItemFactory factory = createFactory(null);
String teststr = constructString(SWISS_GERMAN_STUFF_UNICODE);
@@ -306,8 +281,7 @@
true,
null);
OutputStream outstream = item.getOutputStream();
- for (int i = 0; i < SWISS_GERMAN_STUFF_ISO8859_1.length; i++)
- {
+ for (int i = 0; i < SWISS_GERMAN_STUFF_ISO8859_1.length; i++) {
outstream.write(SWISS_GERMAN_STUFF_ISO8859_1[i]);
}
outstream.close();
@@ -320,8 +294,7 @@
true,
null);
outstream = item.getOutputStream();
- for (int i = 0; i < SWISS_GERMAN_STUFF_UTF8.length; i++)
- {
+ for (int i = 0; i < SWISS_GERMAN_STUFF_UTF8.length; i++) {
outstream.write(SWISS_GERMAN_STUFF_UTF8[i]);
}
outstream.close();
@@ -336,8 +309,7 @@
true,
null);
outstream = item.getOutputStream();
- for (int i = 0; i < RUSSIAN_STUFF_KOI8R.length; i++)
- {
+ for (int i = 0; i < RUSSIAN_STUFF_KOI8R.length; i++) {
outstream.write(RUSSIAN_STUFF_KOI8R[i]);
}
outstream.close();
@@ -350,8 +322,7 @@
true,
null);
outstream = item.getOutputStream();
- for (int i = 0; i < RUSSIAN_STUFF_WIN1251.length; i++)
- {
+ for (int i = 0; i < RUSSIAN_STUFF_WIN1251.length; i++) {
outstream.write(RUSSIAN_STUFF_WIN1251[i]);
}
outstream.close();
@@ -364,11 +335,11 @@
true,
null);
outstream = item.getOutputStream();
- for (int i = 0; i < RUSSIAN_STUFF_UTF8.length; i++)
- {
+ for (int i = 0; i < RUSSIAN_STUFF_UTF8.length; i++) {
outstream.write(RUSSIAN_STUFF_UTF8[i]);
}
outstream.close();
assertEquals(teststr, teststr, item.getString());
}
+
}
diff --git a/src/test/java/org/apache/commons/fileupload/DiskFileItemSerializeTest.java b/src/test/java/org/apache/commons/fileupload/DiskFileItemSerializeTest.java
index adc1ae3..1dfa710 100644
--- a/src/test/java/org/apache/commons/fileupload/DiskFileItemSerializeTest.java
+++ b/src/test/java/org/apache/commons/fileupload/DiskFileItemSerializeTest.java
@@ -35,9 +35,10 @@
/**
* Serialization Unit tests for
* {@link org.apache.commons.fileupload.disk.DiskFileItem}.
+ *
+ * @version $Id$
*/
-public class DiskFileItemSerializeTest
-{
+public class DiskFileItemSerializeTest {
/**
* Content type for regular form items.
@@ -54,9 +55,7 @@
* configured threshold.
*/
@Test
- public void testBelowThreshold() throws Exception
- {
-
+ public void testBelowThreshold() throws Exception {
// Create the FileItem
byte[] testFieldValueBytes = createContentBytes(threshold - 1);
FileItem item = createFileItem(testFieldValueBytes);
@@ -75,7 +74,6 @@
// Compare FileItem's (except byte[])
compareFileItems(item, newItem);
-
}
/**
@@ -103,7 +101,6 @@
// Compare FileItem's (except byte[])
compareFileItems(item, newItem);
-
}
/**
@@ -112,7 +109,6 @@
*/
@Test
public void testAboveThreshold() throws Exception {
-
// Create the FileItem
byte[] testFieldValueBytes = createContentBytes(threshold + 1);
FileItem item = createFileItem(testFieldValueBytes);
@@ -185,14 +181,11 @@
true,
"My File Name"
);
- try
- {
+ try {
OutputStream os = item.getOutputStream();
os.write(contentBytes);
os.close();
- }
- catch(IOException e)
- {
+ } catch(IOException e) {
fail("Unexpected IOException" + e);
}
@@ -204,7 +197,6 @@
* Do serialization and deserialization.
*/
private Object serializeDeserialize(Object target) {
-
// Serialize the test object
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
@@ -228,7 +220,6 @@
fail("Exception during deserialization: " + e);
}
return result;
-
}
}
diff --git a/src/test/java/org/apache/commons/fileupload/FileItemHeadersTest.java b/src/test/java/org/apache/commons/fileupload/FileItemHeadersTest.java
index bace3fa..8bd54c5 100644
--- a/src/test/java/org/apache/commons/fileupload/FileItemHeadersTest.java
+++ b/src/test/java/org/apache/commons/fileupload/FileItemHeadersTest.java
@@ -30,9 +30,10 @@
* Unit tests {@link FileItemHeaders} and
* {@link FileItemHeadersImpl}.
*
- * @author Michael C. Macaluso
+ * @version $Id$
*/
public class FileItemHeadersTest {
+
/**
* @throws Exception
*/
diff --git a/src/test/java/org/apache/commons/fileupload/FileUploadTestCase.java b/src/test/java/org/apache/commons/fileupload/FileUploadTestCase.java
index 91156db..131985b 100644
--- a/src/test/java/org/apache/commons/fileupload/FileUploadTestCase.java
+++ b/src/test/java/org/apache/commons/fileupload/FileUploadTestCase.java
@@ -26,8 +26,11 @@
/**
* Base class for deriving test cases.
+ *
+ * @version $Id$
*/
public abstract class FileUploadTestCase {
+
protected static final String CONTENT_TYPE = "multipart/form-data; boundary=---1234";
protected List<FileItem> parseUpload(byte[] bytes) throws FileUploadException {
@@ -43,9 +46,9 @@
}
protected List<FileItem> parseUpload(String content)
- throws UnsupportedEncodingException, FileUploadException
- {
+ throws UnsupportedEncodingException, FileUploadException {
byte[] bytes = content.getBytes("US-ASCII");
return parseUpload(bytes, CONTENT_TYPE);
}
+
}
diff --git a/src/test/java/org/apache/commons/fileupload/HttpServletRequestFactory.java b/src/test/java/org/apache/commons/fileupload/HttpServletRequestFactory.java
index e770d48..17609ce 100644
--- a/src/test/java/org/apache/commons/fileupload/HttpServletRequestFactory.java
+++ b/src/test/java/org/apache/commons/fileupload/HttpServletRequestFactory.java
@@ -19,17 +19,11 @@
import javax.servlet.http.HttpServletRequest;
/**
- *
- *
- *
- *
- *
- *
+ * @version $Id$
*/
-final class HttpServletRequestFactory
-{
- static public HttpServletRequest createHttpServletRequestWithNullContentType()
- {
+final class HttpServletRequestFactory {
+
+ static public HttpServletRequest createHttpServletRequestWithNullContentType() {
byte[] requestData = "foobar".getBytes();
return new MockHttpServletRequest(
requestData,
@@ -37,8 +31,7 @@
}
static public HttpServletRequest createValidHttpServletRequest(
- final String[] strFileNames)
- {
+ final String[] strFileNames) {
// todo - provide a real implementation
StringBuffer sbRequestData = new StringBuffer();
@@ -56,11 +49,11 @@
FileUploadBase.MULTIPART_FORM_DATA);
}
- static public HttpServletRequest createInvalidHttpServletRequest()
- {
+ static public HttpServletRequest createInvalidHttpServletRequest() {
byte[] requestData = "foobar".getBytes();
return new MockHttpServletRequest(
requestData,
FileUploadBase.MULTIPART_FORM_DATA);
}
+
}
diff --git a/src/test/java/org/apache/commons/fileupload/MockHttpServletRequest.java b/src/test/java/org/apache/commons/fileupload/MockHttpServletRequest.java
index f05b54e..530bfcc 100644
--- a/src/test/java/org/apache/commons/fileupload/MockHttpServletRequest.java
+++ b/src/test/java/org/apache/commons/fileupload/MockHttpServletRequest.java
@@ -33,19 +33,16 @@
import javax.servlet.http.HttpSession;
/**
- *
- *
- *
- *
- *
- *
+ * @version $Id$
*/
-class MockHttpServletRequest implements HttpServletRequest
-{
+class MockHttpServletRequest implements HttpServletRequest {
private final InputStream m_requestData;
+
private final long length;
+
private String m_strContentType;
+
private final Map<String, String> m_headers = new java.util.HashMap<String, String>();
/**
@@ -54,8 +51,7 @@
*/
public MockHttpServletRequest(
final byte[] requestData,
- final String strContentType)
- {
+ final String strContentType) {
this(new ByteArrayInputStream(requestData),
requestData.length, strContentType);
}
@@ -67,8 +63,7 @@
public MockHttpServletRequest(
final InputStream requestData,
final long requestLength,
- final String strContentType)
- {
+ final String strContentType) {
m_requestData = requestData;
length = requestLength;
m_strContentType = strContentType;
@@ -78,40 +73,35 @@
/**
* @see javax.servlet.http.HttpServletRequest#getAuthType()
*/
- public String getAuthType()
- {
+ public String getAuthType() {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#getCookies()
*/
- public Cookie[] getCookies()
- {
+ public Cookie[] getCookies() {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#getDateHeader(String)
*/
- public long getDateHeader(String arg0)
- {
+ public long getDateHeader(String arg0) {
return 0;
}
/**
* @see javax.servlet.http.HttpServletRequest#getHeader(String)
*/
- public String getHeader(String headerName)
- {
+ public String getHeader(String headerName) {
return m_headers.get(headerName);
}
/**
* @see javax.servlet.http.HttpServletRequest#getHeaders(String)
*/
- public Enumeration<String> getHeaders(String arg0)
- {
+ public Enumeration<String> getHeaders(String arg0) {
// todo - implement
return null;
}
@@ -119,8 +109,7 @@
/**
* @see javax.servlet.http.HttpServletRequest#getHeaderNames()
*/
- public Enumeration<String> getHeaderNames()
- {
+ public Enumeration<String> getHeaderNames() {
// todo - implement
return null;
}
@@ -128,144 +117,126 @@
/**
* @see javax.servlet.http.HttpServletRequest#getIntHeader(String)
*/
- public int getIntHeader(String arg0)
- {
+ public int getIntHeader(String arg0) {
return 0;
}
/**
* @see javax.servlet.http.HttpServletRequest#getMethod()
*/
- public String getMethod()
- {
+ public String getMethod() {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#getPathInfo()
*/
- public String getPathInfo()
- {
+ public String getPathInfo() {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#getPathTranslated()
*/
- public String getPathTranslated()
- {
+ public String getPathTranslated() {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#getContextPath()
*/
- public String getContextPath()
- {
+ public String getContextPath() {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#getQueryString()
*/
- public String getQueryString()
- {
+ public String getQueryString() {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#getRemoteUser()
*/
- public String getRemoteUser()
- {
+ public String getRemoteUser() {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#isUserInRole(String)
*/
- public boolean isUserInRole(String arg0)
- {
+ public boolean isUserInRole(String arg0) {
return false;
}
/**
* @see javax.servlet.http.HttpServletRequest#getUserPrincipal()
*/
- public Principal getUserPrincipal()
- {
+ public Principal getUserPrincipal() {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#getRequestedSessionId()
*/
- public String getRequestedSessionId()
- {
+ public String getRequestedSessionId() {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#getRequestURI()
*/
- public String getRequestURI()
- {
+ public String getRequestURI() {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#getRequestURL()
*/
- public StringBuffer getRequestURL()
- {
+ public StringBuffer getRequestURL() {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#getServletPath()
*/
- public String getServletPath()
- {
+ public String getServletPath() {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#getSession(boolean)
*/
- public HttpSession getSession(boolean arg0)
- {
+ public HttpSession getSession(boolean arg0) {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#getSession()
*/
- public HttpSession getSession()
- {
+ public HttpSession getSession() {
return null;
}
/**
* @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdValid()
*/
- public boolean isRequestedSessionIdValid()
- {
+ public boolean isRequestedSessionIdValid() {
return false;
}
/**
* @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromCookie()
*/
- public boolean isRequestedSessionIdFromCookie()
- {
+ public boolean isRequestedSessionIdFromCookie() {
return false;
}
/**
* @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromURL()
*/
- public boolean isRequestedSessionIdFromURL()
- {
+ public boolean isRequestedSessionIdFromURL() {
return false;
}
@@ -274,32 +245,28 @@
* @deprecated
*/
@Deprecated
- public boolean isRequestedSessionIdFromUrl()
- {
+ public boolean isRequestedSessionIdFromUrl() {
return false;
}
/**
* @see javax.servlet.ServletRequest#getAttribute(String)
*/
- public Object getAttribute(String arg0)
- {
+ public Object getAttribute(String arg0) {
return null;
}
/**
* @see javax.servlet.ServletRequest#getAttributeNames()
*/
- public Enumeration<String> getAttributeNames()
- {
+ public Enumeration<String> getAttributeNames() {
return null;
}
/**
* @see javax.servlet.ServletRequest#getCharacterEncoding()
*/
- public String getCharacterEncoding()
- {
+ public String getCharacterEncoding() {
return null;
}
@@ -307,23 +274,18 @@
* @see javax.servlet.ServletRequest#setCharacterEncoding(String)
*/
public void setCharacterEncoding(String arg0)
- throws UnsupportedEncodingException
- {
+ throws UnsupportedEncodingException {
}
/**
* @see javax.servlet.ServletRequest#getContentLength()
*/
- public int getContentLength()
- {
+ public int getContentLength() {
int iLength = 0;
- if (null == m_requestData)
- {
+ if (null == m_requestData) {
iLength = -1;
- }
- else
- {
+ } else {
if (length > Integer.MAX_VALUE) {
throw new RuntimeException("Value '" + length + "' is too large to be converted to int");
}
@@ -335,16 +297,14 @@
/**
* @see javax.servlet.ServletRequest#getContentType()
*/
- public String getContentType()
- {
+ public String getContentType() {
return m_strContentType;
}
/**
* @see javax.servlet.ServletRequest#getInputStream()
*/
- public ServletInputStream getInputStream() throws IOException
- {
+ public ServletInputStream getInputStream() throws IOException {
ServletInputStream sis = new MyServletInputStream(m_requestData);
return sis;
}
@@ -352,166 +312,145 @@
/**
* @see javax.servlet.ServletRequest#getParameter(String)
*/
- public String getParameter(String arg0)
- {
+ public String getParameter(String arg0) {
return null;
}
/**
* @see javax.servlet.ServletRequest#getParameterNames()
*/
- public Enumeration<String> getParameterNames()
- {
+ public Enumeration<String> getParameterNames() {
return null;
}
/**
* @see javax.servlet.ServletRequest#getParameterValues(String)
*/
- public String[] getParameterValues(String arg0)
- {
+ public String[] getParameterValues(String arg0) {
return null;
}
/**
* @see javax.servlet.ServletRequest#getParameterMap()
*/
- public Map<String, String[]> getParameterMap()
- {
+ public Map<String, String[]> getParameterMap() {
return null;
}
/**
* @see javax.servlet.ServletRequest#getProtocol()
*/
- public String getProtocol()
- {
+ public String getProtocol() {
return null;
}
/**
* @see javax.servlet.ServletRequest#getScheme()
*/
- public String getScheme()
- {
+ public String getScheme() {
return null;
}
/**
* @see javax.servlet.ServletRequest#getServerName()
*/
- public String getServerName()
- {
+ public String getServerName() {
return null;
}
/**
* @see javax.servlet.ServletRequest#getLocalName()
*/
- public String getLocalName()
- {
+ public String getLocalName() {
return null;
}
/**
* @see javax.servlet.ServletRequest#getServerPort()
*/
- public int getServerPort()
- {
+ public int getServerPort() {
return 0;
}
/**
* @see javax.servlet.ServletRequest#getLocalPort()
*/
- public int getLocalPort()
- {
+ public int getLocalPort() {
return 0;
}
/**
* @see javax.servlet.ServletRequest#getRemotePort()
*/
- public int getRemotePort()
- {
+ public int getRemotePort() {
return 0;
}
/**
* @see javax.servlet.ServletRequest#getReader()
*/
- public BufferedReader getReader() throws IOException
- {
+ public BufferedReader getReader() throws IOException {
return null;
}
/**
* @see javax.servlet.ServletRequest#getRemoteAddr()
*/
- public String getRemoteAddr()
- {
+ public String getRemoteAddr() {
return null;
}
/**
* @see javax.servlet.ServletRequest#getLocalAddr()
*/
- public String getLocalAddr()
- {
+ public String getLocalAddr() {
return null;
}
/**
* @see javax.servlet.ServletRequest#getRemoteHost()
*/
- public String getRemoteHost()
- {
+ public String getRemoteHost() {
return null;
}
/**
* @see javax.servlet.ServletRequest#setAttribute(String, Object)
*/
- public void setAttribute(String arg0, Object arg1)
- {
+ public void setAttribute(String arg0, Object arg1) {
}
/**
* @see javax.servlet.ServletRequest#removeAttribute(String)
*/
- public void removeAttribute(String arg0)
- {
+ public void removeAttribute(String arg0) {
}
/**
* @see javax.servlet.ServletRequest#getLocale()
*/
- public Locale getLocale()
- {
+ public Locale getLocale() {
return null;
}
/**
* @see javax.servlet.ServletRequest#getLocales()
*/
- public Enumeration<Locale> getLocales()
- {
+ public Enumeration<Locale> getLocales() {
return null;
}
/**
* @see javax.servlet.ServletRequest#isSecure()
*/
- public boolean isSecure()
- {
+ public boolean isSecure() {
return false;
}
/**
* @see javax.servlet.ServletRequest#getRequestDispatcher(String)
*/
- public RequestDispatcher getRequestDispatcher(String arg0)
- {
+ public RequestDispatcher getRequestDispatcher(String arg0) {
return null;
}
@@ -520,8 +459,7 @@
* @deprecated
*/
@Deprecated
- public String getRealPath(String arg0)
- {
+ public String getRealPath(String arg0) {
return null;
}
@@ -532,29 +470,28 @@
*
*/
private static class MyServletInputStream
- extends javax.servlet.ServletInputStream
- {
+ extends javax.servlet.ServletInputStream {
+
private final InputStream in;
/**
* Creates a new instance, which returns the given
* streams data.
*/
- public MyServletInputStream(InputStream pStream)
- {
+ public MyServletInputStream(InputStream pStream) {
in = pStream;
}
@Override
- public int read() throws IOException
- {
+ public int read() throws IOException {
return in.read();
}
@Override
- public int read(byte b[], int off, int len) throws IOException
- {
+ public int read(byte b[], int off, int len) throws IOException {
return in.read(b, off, len);
}
+
}
+
}
diff --git a/src/test/java/org/apache/commons/fileupload/MockPortletRequest.java b/src/test/java/org/apache/commons/fileupload/MockPortletRequest.java
index 8651ebf..cfdf40a 100644
--- a/src/test/java/org/apache/commons/fileupload/MockPortletRequest.java
+++ b/src/test/java/org/apache/commons/fileupload/MockPortletRequest.java
@@ -31,285 +31,312 @@
/**
* A mock portlet request, useful for unit testing and offline utilities
*
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
* @version $Id$
*/
-public class MockPortletRequest implements PortletRequest
-{
+public class MockPortletRequest implements PortletRequest {
+
MockPortletSession session = null;
- public MockPortletRequest()
- {
+ public MockPortletRequest() {
session = new MockPortletSession();
}
/* (non-Javadoc)
* @see javax.portlet.PortletRequest#isWindowStateAllowed(javax.portlet.WindowState)
*/
- public boolean isWindowStateAllowed(WindowState state)
- {
+ public boolean isWindowStateAllowed(WindowState state) {
// TODO Auto-generated method stub
return false;
}
+
/* (non-Javadoc)
* @see javax.portlet.PortletRequest#isPortletModeAllowed(javax.portlet.PortletMode)
*/
- public boolean isPortletModeAllowed(PortletMode mode)
- {
+ public boolean isPortletModeAllowed(PortletMode mode) {
// TODO Auto-generated method stub
return false;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getPortletMode()
*/
- public PortletMode getPortletMode()
- {
+ public PortletMode getPortletMode() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getWindowState()
*/
- public WindowState getWindowState()
- {
+ public WindowState getWindowState() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getPreferences()
*/
- public PortletPreferences getPreferences()
- {
+ public PortletPreferences getPreferences() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getPortletSession()
*/
- public PortletSession getPortletSession()
- {
+ public PortletSession getPortletSession() {
return session;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getPortletSession(boolean)
*/
- public PortletSession getPortletSession(boolean create)
- {
- if (session == null)
+ public PortletSession getPortletSession( boolean create ) {
+ if ( session == null )
{
session = new MockPortletSession();
}
return session;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getProperty(java.lang.String)
*/
- public String getProperty(String name)
- {
+ public String getProperty( String name ) {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getProperties(java.lang.String)
*/
- public Enumeration<String> getProperties(String name)
- {
+ public Enumeration<String> getProperties( String name ) {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getPropertyNames()
*/
- public Enumeration<String> getPropertyNames()
- {
+ public Enumeration<String> getPropertyNames() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getPortalContext()
*/
- public PortalContext getPortalContext()
- {
+ public PortalContext getPortalContext() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getAuthType()
*/
- public String getAuthType()
- {
+ public String getAuthType() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getContextPath()
*/
- public String getContextPath()
- {
+ public String getContextPath() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getRemoteUser()
*/
- public String getRemoteUser()
- {
+ public String getRemoteUser() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getUserPrincipal()
*/
- public Principal getUserPrincipal()
- {
+ public Principal getUserPrincipal() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#isUserInRole(java.lang.String)
*/
- public boolean isUserInRole(String role)
- {
+ public boolean isUserInRole( String role ) {
// TODO Auto-generated method stub
return false;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getAttribute(java.lang.String)
*/
- public Object getAttribute(String name)
- {
+ public Object getAttribute( String name ) {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getAttributeNames()
*/
- public Enumeration<String> getAttributeNames()
- {
+ public Enumeration<String> getAttributeNames() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getParameter(java.lang.String)
*/
- public String getParameter(String name)
- {
+ public String getParameter( String name ) {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getParameterNames()
*/
- public Enumeration<String> getParameterNames()
- {
+ public Enumeration<String> getParameterNames() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getParameterValues(java.lang.String)
*/
- public String[] getParameterValues(String name)
- {
+ public String[] getParameterValues( String name ) {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getParameterMap()
*/
- public Map<String, String[]> getParameterMap()
- {
+ public Map<String, String[]> getParameterMap() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#isSecure()
*/
- public boolean isSecure()
- {
+ public boolean isSecure() {
// TODO Auto-generated method stub
return false;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#setAttribute(java.lang.String, java.lang.Object)
*/
- public void setAttribute(String name, Object o)
- {
+ public void setAttribute( String name, Object o ) {
// TODO Auto-generated method stub
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#removeAttribute(java.lang.String)
*/
- public void removeAttribute(String name)
- {
+ public void removeAttribute( String name ) {
// TODO Auto-generated method stub
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getRequestedSessionId()
*/
- public String getRequestedSessionId()
- {
+ public String getRequestedSessionId() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#isRequestedSessionIdValid()
*/
- public boolean isRequestedSessionIdValid()
- {
+ public boolean isRequestedSessionIdValid() {
// TODO Auto-generated method stub
return false;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getResponseContentType()
*/
- public String getResponseContentType()
- {
+ public String getResponseContentType() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getResponseContentTypes()
*/
- public Enumeration<String> getResponseContentTypes()
- {
+ public Enumeration<String> getResponseContentTypes() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getLocale()
*/
- public Locale getLocale()
- {
+ public Locale getLocale() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getScheme()
*/
- public String getScheme()
- {
+ public String getScheme() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getServerName()
*/
- public String getServerName()
- {
+ public String getServerName() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see javax.portlet.PortletRequest#getServerPort()
*/
- public int getServerPort()
- {
+ public int getServerPort() {
// TODO Auto-generated method stub
return 0;
}
- public Enumeration<Locale> getLocales()
- {
+ public Enumeration<Locale> getLocales() {
return null;
}
diff --git a/src/test/java/org/apache/commons/fileupload/MockPortletSession.java b/src/test/java/org/apache/commons/fileupload/MockPortletSession.java
index ea9ed69..94f4205 100644
--- a/src/test/java/org/apache/commons/fileupload/MockPortletSession.java
+++ b/src/test/java/org/apache/commons/fileupload/MockPortletSession.java
@@ -25,48 +25,41 @@
* A mock portlet session, useful for unit testing and offline utilities
* Note: currently doesn't support scoping
*
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
* @version $Id$
*/
-public class MockPortletSession implements PortletSession
-{
+public class MockPortletSession implements PortletSession {
+
// Hashtable (not HashMap) makes enumerations easier to work with
Hashtable<String, Object> attributes = new Hashtable<String, Object>();
- public MockPortletSession()
- {
+ public MockPortletSession() {
}
-
/* (non-Javadoc)
* @see javax.portlet.PortletSession#getAttribute(java.lang.String)
*/
- public Object getAttribute(String name)
- {
+ public Object getAttribute(String name) {
return attributes.get(name);
}
/* (non-Javadoc)
* @see javax.portlet.PortletSession#getAttribute(java.lang.String, int)
*/
- public Object getAttribute(String name, int scope)
- {
+ public Object getAttribute(String name, int scope) {
return attributes.get(name);
}
/* (non-Javadoc)
* @see javax.portlet.PortletSession#getAttributeNames(int)
*/
- public Enumeration<String> getAttributeNames(int scope)
- {
+ public Enumeration<String> getAttributeNames(int scope) {
return attributes.keys();
}
/* (non-Javadoc)
* @see javax.portlet.PortletSession#getCreationTime()
*/
- public long getCreationTime()
- {
+ public long getCreationTime() {
// TODO Auto-generated method stub
return 0;
}
@@ -74,8 +67,7 @@
/* (non-Javadoc)
* @see javax.portlet.PortletSession#getId()
*/
- public String getId()
- {
+ public String getId() {
// TODO Auto-generated method stub
return null;
}
@@ -83,8 +75,7 @@
/* (non-Javadoc)
* @see javax.portlet.PortletSession#getLastAccessedTime()
*/
- public long getLastAccessedTime()
- {
+ public long getLastAccessedTime() {
// TODO Auto-generated method stub
return 0;
}
@@ -92,8 +83,7 @@
/* (non-Javadoc)
* @see javax.portlet.PortletSession#getMaxInactiveInterval()
*/
- public int getMaxInactiveInterval()
- {
+ public int getMaxInactiveInterval() {
// TODO Auto-generated method stub
return 0;
}
@@ -101,16 +91,14 @@
/* (non-Javadoc)
* @see javax.portlet.PortletSession#invalidate()
*/
- public void invalidate()
- {
+ public void invalidate() {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.portlet.PortletSession#isNew()
*/
- public boolean isNew()
- {
+ public boolean isNew() {
// TODO Auto-generated method stub
return false;
}
@@ -118,54 +106,48 @@
/* (non-Javadoc)
* @see javax.portlet.PortletSession#removeAttribute(java.lang.String)
*/
- public void removeAttribute(String name)
- {
+ public void removeAttribute(String name) {
attributes.remove(name);
}
/* (non-Javadoc)
* @see javax.portlet.PortletSession#removeAttribute(java.lang.String, int)
*/
- public void removeAttribute(String name, int scope)
- {
+ public void removeAttribute(String name, int scope) {
attributes.remove(name);
}
/* (non-Javadoc)
* @see javax.portlet.PortletSession#setAttribute(java.lang.String, java.lang.Object)
*/
- public void setAttribute(String name, Object value)
- {
+ public void setAttribute(String name, Object value) {
attributes.put(name, value);
}
- public Enumeration<String> getAttributeNames()
- {
+ public Enumeration<String> getAttributeNames() {
return this.getAttributeNames(PortletSession.PORTLET_SCOPE);
}
-
/* (non-Javadoc)
* @see javax.portlet.PortletSession#setAttribute(java.lang.String, java.lang.Object, int)
*/
- public void setAttribute(String name, Object value, int scope)
- {
+ public void setAttribute(String name, Object value, int scope) {
attributes.put(name, value);
}
/* (non-Javadoc)
* @see javax.portlet.PortletSession#setMaxInactiveInterval(int)
*/
- public void setMaxInactiveInterval(int interval)
- {
+ public void setMaxInactiveInterval(int interval) {
// TODO Auto-generated method stub
}
+
/* (non-Javadoc)
* @see javax.portlet.PortletSession#getPortletContext()
*/
- public PortletContext getPortletContext()
- {
+ public PortletContext getPortletContext() {
// TODO Auto-generated method stub
return null;
}
+
}
diff --git a/src/test/java/org/apache/commons/fileupload/MultipartStreamTest.java b/src/test/java/org/apache/commons/fileupload/MultipartStreamTest.java
index fdd4080..dd0bdfb 100644
--- a/src/test/java/org/apache/commons/fileupload/MultipartStreamTest.java
+++ b/src/test/java/org/apache/commons/fileupload/MultipartStreamTest.java
@@ -16,19 +16,16 @@
*/
package org.apache.commons.fileupload;
-
import junit.framework.TestCase;
import java.io.*;
-
/**
* Unit tests {@link org.apache.commons.fileupload.MultipartStream}.
*
- * @author Sean C. Sullivan
- *
+ * @version $Id$
*/
-public class MultipartStreamTest extends TestCase
-{
+public class MultipartStreamTest extends TestCase {
+
static private final String BOUNDARY_TEXT = "myboundary";
public void testThreeParamConstructor() throws Exception {
@@ -56,4 +53,5 @@
new MultipartStream.ProgressNotifier(null, contents.length));
assertNotNull(ms);
}
+
}
diff --git a/src/test/java/org/apache/commons/fileupload/ParameterParserTest.java b/src/test/java/org/apache/commons/fileupload/ParameterParserTest.java
index c04872a..f77985c 100644
--- a/src/test/java/org/apache/commons/fileupload/ParameterParserTest.java
+++ b/src/test/java/org/apache/commons/fileupload/ParameterParserTest.java
@@ -26,14 +26,12 @@
/**
* Unit tests for {@link ParameterParser}.
*
- * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
+ * @version $Id$
*/
-public class ParameterParserTest
-{
+public class ParameterParserTest {
@Test
- public void testParsing()
- {
+ public void testParsing() {
String s =
"test; test1 = stuff ; test2 = \"stuff; stuff\"; test3=\"stuff";
ParameterParser parser = new ParameterParser();
@@ -70,8 +68,7 @@
}
@Test
- public void testContentTypeParsing()
- {
+ public void testContentTypeParsing() {
String s = "text/plain; Charset=UTF-8";
ParameterParser parser = new ParameterParser();
parser.setLowerCaseNames(true);
@@ -80,8 +77,7 @@
}
@Test
- public void testParsingEscapedChars()
- {
+ public void testParsingEscapedChars() {
String s = "param = \"stuff\\\"; more stuff\"";
ParameterParser parser = new ParameterParser();
Map<String, String> params = parser.parse(s, ';');
@@ -97,8 +93,7 @@
// See: http://issues.apache.org/jira/browse/FILEUPLOAD-139
@Test
- public void testFileUpload139()
- {
+ public void testFileUpload139() {
ParameterParser parser = new ParameterParser();
String s = "Content-type: multipart/form-data , boundary=AaB03x";
Map<String, String> params = parser.parse(s, new char[] { ',', ';' });
@@ -112,4 +107,5 @@
params = parser.parse(s, new char[] { ',', ';' });
assertEquals("BbC04y", params.get("boundary"));
}
+
}
diff --git a/src/test/java/org/apache/commons/fileupload/ProgressListenerTest.java b/src/test/java/org/apache/commons/fileupload/ProgressListenerTest.java
index 4cf16b2..884f8f8 100644
--- a/src/test/java/org/apache/commons/fileupload/ProgressListenerTest.java
+++ b/src/test/java/org/apache/commons/fileupload/ProgressListenerTest.java
@@ -27,19 +27,28 @@
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.junit.Test;
-
-/** Tests the progress listener.
+/**
+ * Tests the progress listener.
+ *
+ * @version $Id$
*/
public class ProgressListenerTest extends FileUploadTestCase {
+
private class ProgressListenerImpl implements ProgressListener {
+
private final long expectedContentLength;
+
private final int expectedItems;
+
private Long bytesRead;
+
private Integer items;
+
ProgressListenerImpl(long pContentLength, int pItems) {
expectedContentLength = pContentLength;
expectedItems = pItems;
}
+
public void update(long pBytesRead, long pContentLength, int pItems) {
assertTrue(pBytesRead >= 0 && pBytesRead <= expectedContentLength);
assertTrue(pContentLength == -1 || pContentLength == expectedContentLength);
@@ -50,10 +59,12 @@
assertTrue(items == null || pItems >= items.intValue());
items = new Integer(pItems);
}
+
void checkFinished(){
assertEquals(expectedContentLength, bytesRead.longValue());
assertEquals(expectedItems, items.intValue());
}
+
}
/**
@@ -113,4 +124,5 @@
assertTrue(!iter.hasNext());
listener.checkFinished();
}
+
}
diff --git a/src/test/java/org/apache/commons/fileupload/ServletFileUploadTest.java b/src/test/java/org/apache/commons/fileupload/ServletFileUploadTest.java
index 8255f82..fae7119 100644
--- a/src/test/java/org/apache/commons/fileupload/ServletFileUploadTest.java
+++ b/src/test/java/org/apache/commons/fileupload/ServletFileUploadTest.java
@@ -30,20 +30,16 @@
import org.junit.Test;
-@SuppressWarnings("deprecation") // unit tests for deprecated class
-
/**
* Unit tests {@link org.apache.commons.fileupload.DiskFileUpload}.
*
- * @author <a href="mailto:jmcnally@apache.org">John McNally</a>
- * @author Sean C. Sullivan
- *
+ * @version $Id$
*/
-public class ServletFileUploadTest extends FileUploadTestCase
-{
+@SuppressWarnings("deprecation") // unit tests for deprecated class
+public class ServletFileUploadTest extends FileUploadTestCase {
+
@Test
- public void testWithInvalidRequest()
- {
+ public void testWithInvalidRequest() {
FileUploadBase fu = null;
fu = new DiskFileUpload();
@@ -60,36 +56,27 @@
{
// this exception is expected
}
-
}
@Test
- public void testWithNullContentType()
- {
+ public void testWithNullContentType() {
FileUploadBase fu = new DiskFileUpload();
HttpServletRequest req = HttpServletRequestFactory.createHttpServletRequestWithNullContentType();
- try
- {
+ try {
fu.parseRequest(req);
fail("testWithNullContentType: expected exception was not thrown");
- }
- catch (DiskFileUpload.InvalidContentTypeException expected)
- {
+ } catch (DiskFileUpload.InvalidContentTypeException expected) {
// this exception is expected
- }
- catch (FileUploadException unexpected)
- {
+ } catch (FileUploadException unexpected) {
fail("testWithNullContentType: unexpected exception was thrown");
}
-
}
@Test
public void testFileUpload()
- throws IOException, FileUploadException
- {
+ throws IOException, FileUploadException {
List<FileItem> fileItems = parseUpload("-----1234\r\n" +
"Content-Disposition: form-data; name=\"file\"; filename=\"foo.tab\"\r\n" +
"Content-Type: text/whatever\r\n" +
@@ -136,8 +123,7 @@
@Test
public void testFilenameCaseSensitivity()
- throws IOException, FileUploadException
- {
+ throws IOException, FileUploadException {
List<FileItem> fileItems = parseUpload("-----1234\r\n" +
"Content-Disposition: form-data; name=\"FiLe\"; filename=\"FOO.tab\"\r\n" +
"Content-Type: text/whatever\r\n" +
@@ -157,8 +143,7 @@
*/
@Test
public void testEmptyFile()
- throws UnsupportedEncodingException, FileUploadException
- {
+ throws UnsupportedEncodingException, FileUploadException {
List<FileItem> fileItems = parseUpload ("-----1234\r\n" +
"Content-Disposition: form-data; name=\"file\"; filename=\"\"\r\n" +
"\r\n" +
@@ -179,8 +164,7 @@
*/
@Test
public void testIE5MacBug()
- throws UnsupportedEncodingException, FileUploadException
- {
+ throws UnsupportedEncodingException, FileUploadException {
List<FileItem> fileItems = parseUpload("-----1234\r\n" +
"Content-Disposition: form-data; name=\"field1\"\r\n" +
"\r\n" +
@@ -318,14 +302,12 @@
assertEquals("value2", multi1.getString());
}
-
/**
* Test case for <a href="http://issues.apache.org/jira/browse/FILEUPLOAD-130">
*/
@Test
public void testFileUpload130()
- throws Exception
- {
+ throws Exception {
final String[] headerNames = new String[]
{
"SomeHeader", "OtherHeader", "YetAnotherHeader", "WhatAHeader"
@@ -375,19 +357,15 @@
}
private void assertHeaders(String[] pHeaderNames, String[] pHeaderValues,
- FileItem pItem, int pIndex)
- {
- for (int i = 0; i < pHeaderNames.length; i++)
- {
+ FileItem pItem, int pIndex) {
+ for (int i = 0; i < pHeaderNames.length; i++) {
final String value = pItem.getHeaders().getHeader(pHeaderNames[i]);
- if (i == pIndex)
- {
+ if (i == pIndex) {
assertEquals(pHeaderValues[i], value);
- }
- else
- {
+ } else {
assertNull(value);
}
}
}
+
}
diff --git a/src/test/java/org/apache/commons/fileupload/SizesTest.java b/src/test/java/org/apache/commons/fileupload/SizesTest.java
index 2435cca..cea5317 100644
--- a/src/test/java/org/apache/commons/fileupload/SizesTest.java
+++ b/src/test/java/org/apache/commons/fileupload/SizesTest.java
@@ -31,18 +31,19 @@
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.junit.Test;
-
/**
* Unit test for items with varying sizes.
+ *
+ * @version $Id$
*/
-public class SizesTest extends FileUploadTestCase
-{
- /** Runs a test with varying file sizes.
+public class SizesTest extends FileUploadTestCase {
+
+ /**
+ * Runs a test with varying file sizes.
*/
@Test
public void testFileUpload()
- throws IOException, FileUploadException
- {
+ throws IOException, FileUploadException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int add = 16;
int num = 0;
@@ -84,8 +85,7 @@
*/
@Test
public void testFileSizeLimit()
- throws IOException, FileUploadException
- {
+ throws IOException, FileUploadException {
final String request =
"-----1234\r\n" +
"Content-Disposition: form-data; name=\"file\"; filename=\"foo.tab\"\r\n" +
@@ -121,4 +121,5 @@
assertEquals(30, e.getPermittedSize());
}
}
+
}
diff --git a/src/test/java/org/apache/commons/fileupload/StreamingTest.java b/src/test/java/org/apache/commons/fileupload/StreamingTest.java
index c5c0f31..030c0ee 100644
--- a/src/test/java/org/apache/commons/fileupload/StreamingTest.java
+++ b/src/test/java/org/apache/commons/fileupload/StreamingTest.java
@@ -33,18 +33,18 @@
import junit.framework.TestCase;
-
/**
* Unit test for items with varying sizes.
+ *
+ * @version $Id$
*/
-public class StreamingTest extends TestCase
-{
+public class StreamingTest extends TestCase {
+
/**
* Tests a file upload with varying file sizes.
*/
public void testFileUpload()
- throws IOException, FileUploadException
- {
+ throws IOException, FileUploadException {
byte[] request = newRequest();
List<FileItem> fileItems = parseUpload(request);
Iterator<FileItem> fileIter = fileItems.iterator();
@@ -65,7 +65,6 @@
assertTrue(!fileIter.hasNext());
}
-
/**
* Tests, whether an invalid request throws a proper
* exception.
@@ -124,8 +123,7 @@
* Test for FILEUPLOAD-135
*/
public void testFILEUPLOAD135()
- throws IOException, FileUploadException
- {
+ throws IOException, FileUploadException {
byte[] request = newShortRequest();
final ByteArrayInputStream bais = new ByteArrayInputStream(request);
List<FileItem> fileItems = parseUpload(new InputStream() {
@@ -275,4 +273,5 @@
assertTrue(e.getMessage().indexOf("foo.exe\\0.png") != -1);
}
}
+
}