This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-fileupload.git
The following commit(s) were added to refs/heads/master by this push: new aa160b4 Javadoc: Replace <code></code> HTML tags with Javadoc {@code} notation. aa160b4 is described below commit aa160b47b977590a7ed0038fbeda2cbdb3ca560c Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Tue Dec 10 10:47:35 2019 -0500 Javadoc: Replace <code></code> HTML tags with Javadoc {@code} notation. --- .../commons/fileupload2/DefaultFileItem.java | 10 +- .../fileupload2/DefaultFileItemFactory.java | 14 +-- .../apache/commons/fileupload2/DiskFileUpload.java | 38 ++++---- .../org/apache/commons/fileupload2/FileItem.java | 30 +++--- .../commons/fileupload2/FileItemFactory.java | 4 +- .../commons/fileupload2/FileItemHeaders.java | 28 +++--- .../apache/commons/fileupload2/FileItemStream.java | 12 +-- .../org/apache/commons/fileupload2/FileUpload.java | 6 +- .../apache/commons/fileupload2/FileUploadBase.java | 84 ++++++++-------- .../commons/fileupload2/FileUploadException.java | 10 +- .../commons/fileupload2/MultipartStream.java | 108 ++++++++++----------- .../commons/fileupload2/ParameterParser.java | 2 +- .../commons/fileupload2/disk/DiskFileItem.java | 46 ++++----- .../fileupload2/disk/DiskFileItemFactory.java | 8 +- .../fileupload2/impl/FileItemIteratorImpl.java | 11 ++- .../impl/FileSizeLimitExceededException.java | 2 +- .../fileupload2/impl/FileUploadIOException.java | 2 +- .../impl/InvalidContentTypeException.java | 6 +- .../impl/SizeLimitExceededException.java | 2 +- .../fileupload2/impl/UnknownSizeException.java | 4 +- .../apache/commons/fileupload2/package-info.java | 2 +- .../fileupload2/portlet/PortletFileUpload.java | 22 ++--- .../commons/fileupload2/portlet/package-info.java | 2 +- .../fileupload2/servlet/ServletFileUpload.java | 22 ++--- .../commons/fileupload2/servlet/package-info.java | 2 +- .../fileupload2/util/FileItemHeadersImpl.java | 4 +- .../fileupload2/util/LimitedInputStream.java | 32 +++--- .../commons/fileupload2/DefaultFileItemTest.java | 4 +- 28 files changed, 259 insertions(+), 258 deletions(-) diff --git a/src/main/java/org/apache/commons/fileupload2/DefaultFileItem.java b/src/main/java/org/apache/commons/fileupload2/DefaultFileItem.java index d874735..186614e 100644 --- a/src/main/java/org/apache/commons/fileupload2/DefaultFileItem.java +++ b/src/main/java/org/apache/commons/fileupload2/DefaultFileItem.java @@ -33,7 +33,7 @@ import org.apache.commons.fileupload2.disk.DiskFileItem; * {@link #getInputStream()} and process the file without attempting to load * it into memory, which may come handy with large files. * - * @deprecated 1.1 Use <code>DiskFileItem</code> instead. + * @deprecated 1.1 Use {@code DiskFileItem} instead. */ @Deprecated public class DefaultFileItem @@ -42,15 +42,15 @@ public class DefaultFileItem // ----------------------------------------------------------- Constructors /** - * Constructs a new <code>DefaultFileItem</code> instance. + * Constructs a new {@code DefaultFileItem} instance. * * @param fieldName The name of the form field. * @param contentType The content type passed by the browser or - * <code>null</code> if not specified. + * {@code null} if not specified. * @param isFormField Whether or not this item is a plain form field, as * opposed to a file upload. * @param fileName The original file name in the user's file system, or - * <code>null</code> if not specified. + * {@code null} if not specified. * @param sizeThreshold The threshold, in bytes, below which items will be * retained in memory and above which they will be * stored as a file. @@ -58,7 +58,7 @@ public class DefaultFileItem * which files will be created, should the item size * exceed the threshold. * - * @deprecated 1.1 Use <code>DiskFileItem</code> instead. + * @deprecated 1.1 Use {@code DiskFileItem} instead. */ @Deprecated public DefaultFileItem(String fieldName, String contentType, diff --git a/src/main/java/org/apache/commons/fileupload2/DefaultFileItemFactory.java b/src/main/java/org/apache/commons/fileupload2/DefaultFileItemFactory.java index 686c428..4f5aa30 100644 --- a/src/main/java/org/apache/commons/fileupload2/DefaultFileItemFactory.java +++ b/src/main/java/org/apache/commons/fileupload2/DefaultFileItemFactory.java @@ -34,10 +34,10 @@ import org.apache.commons.fileupload2.disk.DiskFileItemFactory; * <ul> * <li>Size threshold is 10KB.</li> * <li>Repository is the system default temp directory, as returned by - * <code>System.getProperty("java.io.tmpdir")</code>.</li> + * {@code System.getProperty("java.io.tmpdir")}.</li> * </ul> * - * @deprecated 1.1 Use <code>DiskFileItemFactory</code> instead. + * @deprecated 1.1 Use {@code DiskFileItemFactory} instead. */ @Deprecated public class DefaultFileItemFactory extends DiskFileItemFactory { @@ -48,7 +48,7 @@ public class DefaultFileItemFactory extends DiskFileItemFactory { * Constructs an unconfigured instance of this class. The resulting factory * may be configured by calling the appropriate setter methods. * - * @deprecated 1.1 Use <code>DiskFileItemFactory</code> instead. + * @deprecated 1.1 Use {@code DiskFileItemFactory} instead. */ @Deprecated public DefaultFileItemFactory() { @@ -65,7 +65,7 @@ public class DefaultFileItemFactory extends DiskFileItemFactory { * which files will be created, should the item size * exceed the threshold. * - * @deprecated 1.1 Use <code>DiskFileItemFactory</code> instead. + * @deprecated 1.1 Use {@code DiskFileItemFactory} instead. */ @Deprecated public DefaultFileItemFactory(int sizeThreshold, File repository) { @@ -81,14 +81,14 @@ public class DefaultFileItemFactory extends DiskFileItemFactory { * * @param fieldName The name of the form field. * @param contentType The content type of the form field. - * @param isFormField <code>true</code> if this is a plain form field; - * <code>false</code> otherwise. + * @param isFormField {@code true} if this is a plain form field; + * {@code false} otherwise. * @param fileName The name of the uploaded file, if any, as supplied * by the browser or other client. * * @return The newly created file item. * - * @deprecated 1.1 Use <code>DiskFileItemFactory</code> instead. + * @deprecated 1.1 Use {@code DiskFileItemFactory} instead. */ @Override @Deprecated diff --git a/src/main/java/org/apache/commons/fileupload2/DiskFileUpload.java b/src/main/java/org/apache/commons/fileupload2/DiskFileUpload.java index c7b6795..412f374 100644 --- a/src/main/java/org/apache/commons/fileupload2/DiskFileUpload.java +++ b/src/main/java/org/apache/commons/fileupload2/DiskFileUpload.java @@ -24,7 +24,7 @@ import javax.servlet.http.HttpServletRequest; * <p>High level API for processing file uploads.</p> * * <p>This class handles multiple files per single HTML widget, sent using - * <code>multipart/mixed</code> encoding type, as specified by + * {@code multipart/mixed} encoding type, as specified by * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>. Use {@link * #parseRequest(HttpServletRequest)} to acquire a list of {@link * org.apache.commons.fileupload2.FileItem}s associated with a given HTML @@ -34,8 +34,8 @@ import javax.servlet.http.HttpServletRequest; * depending on their size, and will be available as {@link * org.apache.commons.fileupload2.FileItem}s.</p> * - * @deprecated 1.1 Use <code>ServletFileUpload</code> together with - * <code>DiskFileItemFactory</code> instead. + * @deprecated 1.1 Use {@code ServletFileUpload} together with + * {@code DiskFileItemFactory} instead. */ @Deprecated public class DiskFileUpload @@ -52,11 +52,11 @@ public class DiskFileUpload /** * Constructs an instance of this class which uses the default factory to - * create <code>FileItem</code> instances. + * create {@code FileItem} instances. * * @see #DiskFileUpload(DefaultFileItemFactory fileItemFactory) * - * @deprecated 1.1 Use <code>FileUpload</code> instead. + * @deprecated 1.1 Use {@code FileUpload} instead. */ @Deprecated public DiskFileUpload() { @@ -66,12 +66,12 @@ public class DiskFileUpload /** * Constructs an instance of this class which uses the supplied factory to - * create <code>FileItem</code> instances. + * create {@code FileItem} instances. * * @see #DiskFileUpload() * @param fileItemFactory The file item factory to use. * - * @deprecated 1.1 Use <code>FileUpload</code> instead. + * @deprecated 1.1 Use {@code FileUpload} instead. */ @Deprecated public DiskFileUpload(DefaultFileItemFactory fileItemFactory) { @@ -86,7 +86,7 @@ public class DiskFileUpload * * @return The factory class for new file items. * - * @deprecated 1.1 Use <code>FileUpload</code> instead. + * @deprecated 1.1 Use {@code FileUpload} instead. */ @Override @Deprecated @@ -96,12 +96,12 @@ public class DiskFileUpload /** * Sets the factory class to use when creating file items. The factory must - * be an instance of <code>DefaultFileItemFactory</code> or a subclass - * thereof, or else a <code>ClassCastException</code> will be thrown. + * be an instance of {@code DefaultFileItemFactory} or a subclass + * thereof, or else a {@code ClassCastException} will be thrown. * * @param factory The factory class for new file items. * - * @deprecated 1.1 Use <code>FileUpload</code> instead. + * @deprecated 1.1 Use {@code FileUpload} instead. */ @Override @Deprecated @@ -117,7 +117,7 @@ public class DiskFileUpload * * @see #setSizeThreshold(int) * - * @deprecated 1.1 Use <code>DiskFileItemFactory</code> instead. + * @deprecated 1.1 Use {@code DiskFileItemFactory} instead. */ @Deprecated public int getSizeThreshold() { @@ -131,7 +131,7 @@ public class DiskFileUpload * * @see #getSizeThreshold() * - * @deprecated 1.1 Use <code>DiskFileItemFactory</code> instead. + * @deprecated 1.1 Use {@code DiskFileItemFactory} instead. */ @Deprecated public void setSizeThreshold(int sizeThreshold) { @@ -146,7 +146,7 @@ public class DiskFileUpload * * @see #setRepositoryPath(String) * - * @deprecated 1.1 Use <code>DiskFileItemFactory</code> instead. + * @deprecated 1.1 Use {@code DiskFileItemFactory} instead. */ @Deprecated public String getRepositoryPath() { @@ -161,7 +161,7 @@ public class DiskFileUpload * * @see #getRepositoryPath() * - * @deprecated 1.1 Use <code>DiskFileItemFactory</code> instead. + * @deprecated 1.1 Use {@code DiskFileItemFactory} instead. */ @Deprecated public void setRepositoryPath(String repositoryPath) { @@ -172,21 +172,21 @@ public class DiskFileUpload /** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> - * compliant <code>multipart/form-data</code> stream. If files are stored - * on disk, the path is given by <code>getRepository()</code>. + * compliant {@code multipart/form-data} stream. If files are stored + * on disk, the path is given by {@code getRepository()}. * * @param req The servlet request to be parsed. Must be non-null. * @param sizeThreshold The max size in bytes to be stored in memory. * @param sizeMax The maximum allowed upload size, in bytes. * @param path The location where the files should be stored. * - * @return A list of <code>FileItem</code> instances parsed from the + * @return A list of {@code FileItem} instances parsed from the * request, in the order that they were transmitted. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. * - * @deprecated 1.1 Use <code>ServletFileUpload</code> instead. + * @deprecated 1.1 Use {@code ServletFileUpload} instead. */ @Deprecated public List<FileItem> parseRequest(HttpServletRequest req, diff --git a/src/main/java/org/apache/commons/fileupload2/FileItem.java b/src/main/java/org/apache/commons/fileupload2/FileItem.java index 4d49029..0a888b8 100644 --- a/src/main/java/org/apache/commons/fileupload2/FileItem.java +++ b/src/main/java/org/apache/commons/fileupload2/FileItem.java @@ -24,7 +24,7 @@ import java.io.UnsupportedEncodingException; /** * <p> This class represents a file or form item that was received within a - * <code>multipart/form-data</code> POST request. + * {@code multipart/form-data} POST request. * * <p> After retrieving an instance of this class from a {@link * org.apache.commons.fileupload2.FileUpload FileUpload} instance (see @@ -36,11 +36,11 @@ import java.io.UnsupportedEncodingException; * it into memory, which may come handy with large files. * * <p> While this interface does not extend - * <code>javax.activation.DataSource</code> per se (to avoid a seldom used + * {@code javax.activation.DataSource} per se (to avoid a seldom used * dependency), several of the defined methods are specifically defined with * the same signatures as methods in that interface. This allows an * implementation of this interface to also implement - * <code>javax.activation.DataSource</code> with minimal additional work. + * {@code javax.activation.DataSource} with minimal additional work. * * @since 1.3 additionally implements FileItemHeadersSupport */ @@ -60,10 +60,10 @@ public interface FileItem extends FileItemHeadersSupport { InputStream getInputStream() throws IOException; /** - * Returns the content type passed by the browser or <code>null</code> if + * Returns the content type passed by the browser or {@code null} if * not defined. * - * @return The content type passed by the browser or <code>null</code> if + * @return The content type passed by the browser or {@code null} if * not defined. */ String getContentType(); @@ -88,8 +88,8 @@ public interface FileItem extends FileItemHeadersSupport { * Provides a hint as to whether or not the file contents will be read * from memory. * - * @return <code>true</code> if the file contents will be read from memory; - * <code>false</code> otherwise. + * @return {@code true} if the file contents will be read from memory; + * {@code false} otherwise. */ boolean isInMemory(); @@ -141,7 +141,7 @@ public interface FileItem extends FileItemHeadersSupport { * example, file renaming, where possible, rather than copying all of the * underlying data, thus gaining a significant performance benefit. * - * @param file The <code>File</code> into which the uploaded item should + * @param file The {@code File} into which the uploaded item should * be stored. * * @throws Exception if an error occurs. @@ -151,7 +151,7 @@ public interface FileItem extends FileItemHeadersSupport { /** * Deletes the underlying storage for a file item, including deleting any * associated temporary disk file. Although this storage will be deleted - * automatically when the <code>FileItem</code> instance is garbage + * automatically when the {@code FileItem} instance is garbage * collected, this method can be used to ensure that this is done at an * earlier time, thus preserving system resources. */ @@ -173,20 +173,20 @@ public interface FileItem extends FileItemHeadersSupport { void setFieldName(String name); /** - * Determines whether or not a <code>FileItem</code> instance represents + * Determines whether or not a {@code FileItem} instance represents * a simple form field. * - * @return <code>true</code> if the instance represents a simple form - * field; <code>false</code> if it represents an uploaded file. + * @return {@code true} if the instance represents a simple form + * field; {@code false} if it represents an uploaded file. */ boolean isFormField(); /** - * Specifies whether or not a <code>FileItem</code> instance represents + * Specifies whether or not a {@code FileItem} instance represents * a simple form field. * - * @param state <code>true</code> if the instance represents a simple form - * field; <code>false</code> if it represents an uploaded file. + * @param state {@code true} if the instance represents a simple form + * field; {@code false} if it represents an uploaded file. */ void setFormField(boolean state); diff --git a/src/main/java/org/apache/commons/fileupload2/FileItemFactory.java b/src/main/java/org/apache/commons/fileupload2/FileItemFactory.java index 70fc042..1ea59cd 100644 --- a/src/main/java/org/apache/commons/fileupload2/FileItemFactory.java +++ b/src/main/java/org/apache/commons/fileupload2/FileItemFactory.java @@ -29,8 +29,8 @@ public interface FileItemFactory { * * @param fieldName The name of the form field. * @param contentType The content type of the form field. - * @param isFormField <code>true</code> if this is a plain form field; - * <code>false</code> otherwise. + * @param isFormField {@code true} if this is a plain form field; + * {@code false} otherwise. * @param fileName The name of the uploaded file, if any, as supplied * by the browser or other client. * diff --git a/src/main/java/org/apache/commons/fileupload2/FileItemHeaders.java b/src/main/java/org/apache/commons/fileupload2/FileItemHeaders.java index f154c28..907ffbf 100644 --- a/src/main/java/org/apache/commons/fileupload2/FileItemHeaders.java +++ b/src/main/java/org/apache/commons/fileupload2/FileItemHeaders.java @@ -20,7 +20,7 @@ import java.util.Iterator; /** * <p> This class provides support for accessing the headers for a file or form - * item that was received within a <code>multipart/form-data</code> POST + * item that was received within a {@code multipart/form-data} POST * request.</p> * * @since 1.2.1 @@ -28,16 +28,16 @@ import java.util.Iterator; public interface FileItemHeaders { /** - * Returns the value of the specified part header as a <code>String</code>. + * Returns the value of the specified part header as a {@code String}. * * If the part did not include a header of the specified name, this method - * return <code>null</code>. If there are multiple headers with the same + * return {@code null}. If there are multiple headers with the same * name, this method returns the first header in the item. The header * name is case insensitive. * - * @param name a <code>String</code> specifying the header name - * @return a <code>String</code> containing the value of the requested - * header, or <code>null</code> if the item does not have a header + * @param name a {@code String} specifying the header name + * @return a {@code String} containing the value of the requested + * header, or {@code null} if the item does not have a header * of that name */ String getHeader(String name); @@ -45,29 +45,29 @@ public interface FileItemHeaders { /** * <p> * Returns all the values of the specified item header as an - * <code>Iterator</code> of <code>String</code> objects. + * {@code Iterator} of {@code String} objects. * </p> * <p> * If the item did not include any headers of the specified name, this - * method returns an empty <code>Iterator</code>. The header name is + * method returns an empty {@code Iterator}. The header name is * case insensitive. * </p> * - * @param name a <code>String</code> specifying the header name - * @return an <code>Iterator</code> containing the values of the + * @param name a {@code String} specifying the header name + * @return an {@code Iterator} containing the values of the * requested header. If the item does not have any headers of - * that name, return an empty <code>Iterator</code> + * that name, return an empty {@code Iterator} */ Iterator<String> getHeaders(String name); /** * <p> - * Returns an <code>Iterator</code> of all the header names. + * Returns an {@code Iterator} of all the header names. * </p> * - * @return an <code>Iterator</code> containing all of the names of + * @return an {@code Iterator} containing all of the names of * headers provided with this file item. If the item does not have - * any headers return an empty <code>Iterator</code> + * any headers return an empty {@code Iterator} */ Iterator<String> getHeaderNames(); diff --git a/src/main/java/org/apache/commons/fileupload2/FileItemStream.java b/src/main/java/org/apache/commons/fileupload2/FileItemStream.java index d4e01fa..e36a2fe 100644 --- a/src/main/java/org/apache/commons/fileupload2/FileItemStream.java +++ b/src/main/java/org/apache/commons/fileupload2/FileItemStream.java @@ -21,7 +21,7 @@ import java.io.InputStream; /** * <p> This interface provides access to a file or form item that was - * received within a <code>multipart/form-data</code> POST request. + * received within a {@code multipart/form-data} POST request. * The items contents are retrieved by calling {@link #openStream()}.</p> * <p>Instances of this class are created by accessing the * iterator, returned by @@ -64,10 +64,10 @@ public interface FileItemStream extends FileItemHeadersSupport { InputStream openStream() throws IOException; /** - * Returns the content type passed by the browser or <code>null</code> if + * Returns the content type passed by the browser or {@code null} if * not defined. * - * @return The content type passed by the browser or <code>null</code> if + * @return The content type passed by the browser or {@code null} if * not defined. */ String getContentType(); @@ -91,11 +91,11 @@ public interface FileItemStream extends FileItemHeadersSupport { String getFieldName(); /** - * Determines whether or not a <code>FileItem</code> instance represents + * Determines whether or not a {@code FileItem} instance represents * a simple form field. * - * @return <code>true</code> if the instance represents a simple form - * field; <code>false</code> if it represents an uploaded file. + * @return {@code true} if the instance represents a simple form + * field; {@code false} if it represents an uploaded file. */ boolean isFormField(); diff --git a/src/main/java/org/apache/commons/fileupload2/FileUpload.java b/src/main/java/org/apache/commons/fileupload2/FileUpload.java index 25af3b1..95f4898 100644 --- a/src/main/java/org/apache/commons/fileupload2/FileUpload.java +++ b/src/main/java/org/apache/commons/fileupload2/FileUpload.java @@ -20,7 +20,7 @@ package org.apache.commons.fileupload2; * <p>High level API for processing file uploads.</p> * * <p>This class handles multiple files per single HTML widget, sent using - * <code>multipart/mixed</code> encoding type, as specified by + * {@code multipart/mixed} encoding type, as specified by * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>. Use {@link * #parseRequest(RequestContext)} to acquire a list * of {@link org.apache.commons.fileupload2.FileItem FileItems} associated @@ -46,7 +46,7 @@ public class FileUpload * Constructs an uninitialised instance of this class. * * A factory must be - * configured, using <code>setFileItemFactory()</code>, before attempting + * configured, using {@code setFileItemFactory()}, before attempting * to parse requests. * * @see #FileUpload(FileItemFactory) @@ -57,7 +57,7 @@ public class FileUpload /** * Constructs an instance of this class which uses the supplied factory to - * create <code>FileItem</code> instances. + * create {@code FileItem} instances. * * @see #FileUpload() * @param fileItemFactory The factory to use for creating file items. diff --git a/src/main/java/org/apache/commons/fileupload2/FileUploadBase.java b/src/main/java/org/apache/commons/fileupload2/FileUploadBase.java index 5b03531..ca3c85a 100644 --- a/src/main/java/org/apache/commons/fileupload2/FileUploadBase.java +++ b/src/main/java/org/apache/commons/fileupload2/FileUploadBase.java @@ -42,7 +42,7 @@ import org.apache.commons.fileupload2.util.Streams; * <p>High level API for processing file uploads.</p> * * <p>This class handles multiple files per single HTML widget, sent using - * <code>multipart/mixed</code> encoding type, as specified by + * {@code multipart/mixed} encoding type, as specified by * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>. Use {@link * #parseRequest(RequestContext)} to acquire a list of {@link * org.apache.commons.fileupload2.FileItem}s associated with a given HTML @@ -61,14 +61,14 @@ public abstract class FileUploadBase { * content.</p> * * <p><strong>NOTE:</strong>This method will be moved to the - * <code>ServletFileUpload</code> class after the FileUpload 1.1 release. + * {@code ServletFileUpload} class after the FileUpload 1.1 release. * Unfortunately, since this method is static, it is not possible to * provide its replacement until this method is removed.</p> * * @param ctx The request context to be evaluated. Must be non-null. * - * @return <code>true</code> if the request is multipart; - * <code>false</code> otherwise. + * @return {@code true} if the request is multipart; + * {@code false} otherwise. */ public static final boolean isMultipartContent(RequestContext ctx) { String contentType = ctx.getContentType(); @@ -87,10 +87,10 @@ public abstract class FileUploadBase { * * @param req The servlet request to be evaluated. Must be non-null. * - * @return <code>true</code> if the request is multipart; - * <code>false</code> otherwise. + * @return {@code true} if the request is multipart; + * {@code false} otherwise. * - * @deprecated 1.1 Use the method on <code>ServletFileUpload</code> instead. + * @deprecated 1.1 Use the method on {@code ServletFileUpload} instead. */ @Deprecated public static boolean isMultipartContent(HttpServletRequest req) { @@ -241,8 +241,8 @@ public abstract class FileUploadBase { /** * Retrieves the character encoding used when reading the headers of an - * individual part. When not specified, or <code>null</code>, the request - * encoding is used. If that is also not specified, or <code>null</code>, + * individual part. When not specified, or {@code null}, the request + * encoding is used. If that is also not specified, or {@code null}, * the platform default encoding is used. * * @return The encoding used to read part headers. @@ -253,8 +253,8 @@ public abstract class FileUploadBase { /** * Specifies the character encoding to be used when reading the headers of - * individual part. When not specified, or <code>null</code>, the request - * encoding is used. If that is also not specified, or <code>null</code>, + * individual part. When not specified, or {@code null}, the request + * encoding is used. If that is also not specified, or {@code null}, * the platform default encoding is used. * * @param encoding The encoding used to read part headers. @@ -267,11 +267,11 @@ public abstract class FileUploadBase { /** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> - * compliant <code>multipart/form-data</code> stream. + * compliant {@code multipart/form-data} stream. * * @param req The servlet request to be parsed. * - * @return A list of <code>FileItem</code> instances parsed from the + * @return A list of {@code FileItem} instances parsed from the * request, in the order that they were transmitted. * * @throws FileUploadException if there are problems reading/parsing @@ -287,11 +287,11 @@ public abstract class FileUploadBase { /** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> - * compliant <code>multipart/form-data</code> stream. + * compliant {@code multipart/form-data} stream. * * @param ctx The context for the request to be parsed. * - * @return An iterator to instances of <code>FileItemStream</code> + * @return An iterator to instances of {@code FileItemStream} * parsed from the request, in the order that they were * transmitted. * @@ -313,11 +313,11 @@ public abstract class FileUploadBase { /** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> - * compliant <code>multipart/form-data</code> stream. + * compliant {@code multipart/form-data} stream. * * @param ctx The context for the request to be parsed. * - * @return A list of <code>FileItem</code> instances parsed from the + * @return A list of {@code FileItem} instances parsed from the * request, in the order that they were transmitted. * * @throws FileUploadException if there are problems reading/parsing @@ -373,11 +373,11 @@ public abstract class FileUploadBase { /** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> - * compliant <code>multipart/form-data</code> stream. + * compliant {@code multipart/form-data} stream. * * @param ctx The context for the request to be parsed. * - * @return A map of <code>FileItem</code> instances parsed from the request. + * @return A map of {@code FileItem} instances parsed from the request. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. @@ -407,7 +407,7 @@ public abstract class FileUploadBase { // ------------------------------------------------------ Protected methods /** - * Retrieves the boundary from the <code>Content-type</code> header. + * Retrieves the boundary from the {@code Content-type} header. * * @param contentType The value of the content type header from which to * extract the boundary value. @@ -434,12 +434,12 @@ public abstract class FileUploadBase { } /** - * Retrieves the file name from the <code>Content-disposition</code> + * Retrieves the file name from the {@code Content-disposition} * header. * - * @param headers A <code>Map</code> containing the HTTP request headers. + * @param headers A {@code Map} containing the HTTP request headers. * - * @return The file name for the current <code>encapsulation</code>. + * @return The file name for the current {@code encapsulation}. * @deprecated 1.2.1 Use {@link #getFileName(FileItemHeaders)}. */ @Deprecated @@ -448,12 +448,12 @@ public abstract class FileUploadBase { } /** - * Retrieves the file name from the <code>Content-disposition</code> + * Retrieves the file name from the {@code Content-disposition} * header. * * @param headers The HTTP headers object. * - * @return The file name for the current <code>encapsulation</code>. + * @return The file name for the current {@code encapsulation}. */ public String getFileName(FileItemHeaders headers) { return getFileName(headers.getHeader(CONTENT_DISPOSITION)); @@ -490,12 +490,12 @@ public abstract class FileUploadBase { } /** - * Retrieves the field name from the <code>Content-disposition</code> + * Retrieves the field name from the {@code Content-disposition} * header. * - * @param headers A <code>Map</code> containing the HTTP request headers. + * @param headers A {@code Map} containing the HTTP request headers. * - * @return The field name for the current <code>encapsulation</code>. + * @return The field name for the current {@code encapsulation}. */ public String getFieldName(FileItemHeaders headers) { return getFieldName(headers.getHeader(CONTENT_DISPOSITION)); @@ -524,12 +524,12 @@ public abstract class FileUploadBase { } /** - * Retrieves the field name from the <code>Content-disposition</code> + * Retrieves the field name from the {@code Content-disposition} * header. * - * @param headers A <code>Map</code> containing the HTTP request headers. + * @param headers A {@code Map} containing the HTTP request headers. * - * @return The field name for the current <code>encapsulation</code>. + * @return The field name for the current {@code encapsulation}. * @deprecated 1.2.1 Use {@link #getFieldName(FileItemHeaders)}. */ @Deprecated @@ -540,12 +540,12 @@ public abstract class FileUploadBase { /** * Creates a new {@link FileItem} instance. * - * @param headers A <code>Map</code> containing the HTTP request + * @param headers A {@code Map} containing the HTTP request * headers. * @param isFormField Whether or not this item is a form field, as * opposed to a file. * - * @return A newly created <code>FileItem</code> instance. + * @return A newly created {@code FileItem} instance. * * @throws FileUploadException if an error occurs. * @deprecated 1.2 This method is no longer used in favour of @@ -562,16 +562,16 @@ public abstract class FileUploadBase { } /** - * <p> Parses the <code>header-part</code> and returns as key/value + * <p> Parses the {@code header-part} and returns as key/value * pairs. * * <p> If there are multiple headers of the same names, the name * will map to a comma-separated list containing the values. * - * @param headerPart The <code>header-part</code> of the current - * <code>encapsulation</code>. + * @param headerPart The {@code header-part} of the current + * {@code encapsulation}. * - * @return A <code>Map</code> containing the parsed HTTP request headers. + * @return A {@code Map} containing the parsed HTTP request headers. */ public FileItemHeaders getParsedHeaders(String headerPart) { final int len = headerPart.length(); @@ -615,16 +615,16 @@ public abstract class FileUploadBase { } /** - * <p> Parses the <code>header-part</code> and returns as key/value + * <p> Parses the {@code header-part} and returns as key/value * pairs. * * <p> If there are multiple headers of the same names, the name * will map to a comma-separated list containing the values. * - * @param headerPart The <code>header-part</code> of the current - * <code>encapsulation</code>. + * @param headerPart The {@code header-part} of the current + * {@code encapsulation}. * - * @return A <code>Map</code> containing the parsed HTTP request headers. + * @return A {@code Map} containing the parsed HTTP request headers. * @deprecated 1.2.1 Use {@link #getParsedHeaders(String)} */ @Deprecated @@ -687,7 +687,7 @@ public abstract class FileUploadBase { * Returns the header with the specified name from the supplied map. The * header lookup is case-insensitive. * - * @param headers A <code>Map</code> containing the HTTP request headers. + * @param headers A {@code Map} containing the HTTP request headers. * @param name The name of the header to return. * * @return The value of specified header, or a comma-separated list if diff --git a/src/main/java/org/apache/commons/fileupload2/FileUploadException.java b/src/main/java/org/apache/commons/fileupload2/FileUploadException.java index 85c993d..5e8678c 100644 --- a/src/main/java/org/apache/commons/fileupload2/FileUploadException.java +++ b/src/main/java/org/apache/commons/fileupload2/FileUploadException.java @@ -37,14 +37,14 @@ public class FileUploadException extends Exception { private final Throwable cause; /** - * Constructs a new <code>FileUploadException</code> without message. + * Constructs a new {@code FileUploadException} without message. */ public FileUploadException() { this(null, null); } /** - * Constructs a new <code>FileUploadException</code> with specified detail + * Constructs a new {@code FileUploadException} with specified detail * message. * * @param msg the error message. @@ -54,7 +54,7 @@ public class FileUploadException extends Exception { } /** - * Creates a new <code>FileUploadException</code> with the given + * Creates a new {@code FileUploadException} with the given * detail message and cause. * * @param msg The exceptions detail message. @@ -68,7 +68,7 @@ public class FileUploadException extends Exception { /** * Prints this throwable and its backtrace to the specified print stream. * - * @param stream <code>PrintStream</code> to use for output + * @param stream {@code PrintStream} to use for output */ @Override public void printStackTrace(PrintStream stream) { @@ -83,7 +83,7 @@ public class FileUploadException extends Exception { * Prints this throwable and its backtrace to the specified * print writer. * - * @param writer <code>PrintWriter</code> to use for output + * @param writer {@code PrintWriter} to use for output */ @Override public void printStackTrace(PrintWriter writer) { diff --git a/src/main/java/org/apache/commons/fileupload2/MultipartStream.java b/src/main/java/org/apache/commons/fileupload2/MultipartStream.java index 4d14b01..9e57df2 100644 --- a/src/main/java/org/apache/commons/fileupload2/MultipartStream.java +++ b/src/main/java/org/apache/commons/fileupload2/MultipartStream.java @@ -171,7 +171,7 @@ public class MultipartStream { public static final byte DASH = 0x2D; /** - * The maximum length of <code>header-part</code> that will be + * The maximum length of {@code header-part} that will be * processed (10 kilobytes = 10240 bytes.). */ public static final int HEADER_PART_SIZE_MAX = 10240; @@ -182,25 +182,25 @@ public class MultipartStream { protected static final int DEFAULT_BUFSIZE = 4096; /** - * A byte sequence that marks the end of <code>header-part</code> - * (<code>CRLFCRLF</code>). + * A byte sequence that marks the end of {@code header-part} + * ({@code CRLFCRLF}). */ protected static final byte[] HEADER_SEPARATOR = {CR, LF, CR, LF}; /** * A byte sequence that that follows a delimiter that will be - * followed by an encapsulation (<code>CRLF</code>). + * followed by an encapsulation ({@code CRLF}). */ protected static final byte[] FIELD_SEPARATOR = {CR, LF}; /** * A byte sequence that that follows a delimiter of the last - * encapsulation in the stream (<code>--</code>). + * encapsulation in the stream ({@code --}). */ protected static final byte[] STREAM_TERMINATOR = {DASH, DASH}; /** - * A byte sequence that precedes a boundary (<code>CRLF--</code>). + * A byte sequence that precedes a boundary ({@code CRLF--}). */ protected static final byte[] BOUNDARY_PREFIX = {CR, LF, DASH, DASH}; @@ -212,7 +212,7 @@ public class MultipartStream { private final InputStream input; /** - * The length of the boundary token plus the leading <code>CRLF--</code>. + * The length of the boundary token plus the leading {@code CRLF--}. */ private int boundaryLength; @@ -280,7 +280,7 @@ public class MultipartStream { } /** - * <p> Constructs a <code>MultipartStream</code> with a custom size buffer + * <p> Constructs a {@code MultipartStream} with a custom size buffer * and no progress notifier. * * <p> Note that the buffer must be at least big enough to contain the @@ -288,9 +288,9 @@ public class MultipartStream { * least one byte of data. Too small a buffer size setting will degrade * performance. * - * @param input The <code>InputStream</code> to serve as a data source. + * @param input The {@code InputStream} to serve as a data source. * @param boundary The token used for dividing the stream into - * <code>encapsulations</code>. + * {@code encapsulations}. * @param bufSize The size of the buffer to be used, in bytes. * * @deprecated 1.2.1 Use {@link #MultipartStream(InputStream, byte[], int, @@ -302,16 +302,16 @@ public class MultipartStream { } /** - * <p> Constructs a <code>MultipartStream</code> with a custom size buffer. + * <p> Constructs a {@code MultipartStream} with a custom size buffer. * * <p> Note that the buffer must be at least big enough to contain the * boundary string, plus 4 characters for CR/LF and double dash, plus at * least one byte of data. Too small a buffer size setting will degrade * performance. * - * @param input The <code>InputStream</code> to serve as a data source. + * @param input The {@code InputStream} to serve as a data source. * @param boundary The token used for dividing the stream into - * <code>encapsulations</code>. + * {@code encapsulations}. * @param bufSize The size of the buffer to be used, in bytes. * @param pNotifier The notifier, which is used for calling the * progress listener, if any. @@ -356,11 +356,11 @@ public class MultipartStream { } /** - * <p> Constructs a <code>MultipartStream</code> with a default size buffer. + * <p> Constructs a {@code MultipartStream} with a default size buffer. * - * @param input The <code>InputStream</code> to serve as a data source. + * @param input The {@code InputStream} to serve as a data source. * @param boundary The token used for dividing the stream into - * <code>encapsulations</code>. + * {@code encapsulations}. * @param pNotifier An object for calling the progress listener, if any. * * @@ -373,11 +373,11 @@ public class MultipartStream { } /** - * <p> Constructs a <code>MultipartStream</code> with a default size buffer. + * <p> Constructs a {@code MultipartStream} with a default size buffer. * - * @param input The <code>InputStream</code> to serve as a data source. + * @param input The {@code InputStream} to serve as a data source. * @param boundary The token used for dividing the stream into - * <code>encapsulations</code>. + * {@code encapsulations}. * * @deprecated 1.2.1 Use {@link #MultipartStream(InputStream, byte[], int, * ProgressNotifier)}. @@ -392,7 +392,7 @@ public class MultipartStream { /** * Retrieves the character encoding used when reading the headers of an - * individual part. When not specified, or <code>null</code>, the platform + * individual part. When not specified, or {@code null}, the platform * default encoding is used. * * @return The encoding used to read part headers. @@ -403,7 +403,7 @@ public class MultipartStream { /** * Specifies the character encoding to be used when reading the headers of - * individual parts. When not specified, or <code>null</code>, the platform + * individual parts. When not specified, or {@code null}, the platform * default encoding is used. * * @param encoding The encoding used to read part headers. @@ -413,7 +413,7 @@ public class MultipartStream { } /** - * Reads a byte from the <code>buffer</code>, and refills it as + * Reads a byte from the {@code buffer}, and refills it as * necessary. * * @return The next byte from the input stream. @@ -438,11 +438,11 @@ public class MultipartStream { } /** - * Skips a <code>boundary</code> token, and checks whether more - * <code>encapsulations</code> are contained in the stream. + * Skips a {@code boundary} token, and checks whether more + * {@code encapsulations} are contained in the stream. * - * @return <code>true</code> if there are more encapsulations in - * this stream; <code>false</code> otherwise. + * @return {@code true} if there are more encapsulations in + * this stream; {@code false} otherwise. * * @throws FileUploadIOException if the bytes read from the stream exceeded the size limits * @throws MalformedStreamException if the stream ends unexpectedly or @@ -490,7 +490,7 @@ public class MultipartStream { * <p>This method allows single pass processing of nested multipart * streams. * - * <p>The boundary token of the nested stream is <code>required</code> + * <p>The boundary token of the nested stream is {@code required} * to be of the same length as the boundary token in parent stream. * * <p>Restoring the parent stream boundary token after processing of a @@ -499,7 +499,7 @@ public class MultipartStream { * @param boundary The boundary to be used for parsing of the nested * stream. * - * @throws IllegalBoundaryException if the <code>boundary</code> + * @throws IllegalBoundaryException if the {@code boundary} * has a different length than the one * being currently parsed. */ @@ -539,17 +539,17 @@ public class MultipartStream { } /** - * <p>Reads the <code>header-part</code> of the current - * <code>encapsulation</code>. + * <p>Reads the {@code header-part} of the current + * {@code encapsulation}. * * <p>Headers are returned verbatim to the input stream, including the - * trailing <code>CRLF</code> marker. Parsing is left to the + * trailing {@code CRLF} marker. Parsing is left to the * application. * * <p><strong>TODO</strong> allow limiting maximum header size to * protect against abuse. * - * @return The <code>header-part</code> of the current encapsulation. + * @return The {@code header-part} of the current encapsulation. * * @throws FileUploadIOException if the bytes read from the stream exceeded the size limits. * @throws MalformedStreamException if the stream ends unexpectedly. @@ -599,16 +599,16 @@ public class MultipartStream { } /** - * <p>Reads <code>body-data</code> from the current - * <code>encapsulation</code> and writes its contents into the - * output <code>Stream</code>. + * <p>Reads {@code body-data} from the current + * {@code encapsulation} and writes its contents into the + * output {@code Stream}. * * <p>Arbitrary large amounts of data can be processed by this * method using a constant size buffer. (see {@link * #MultipartStream(InputStream,byte[],int, * MultipartStream.ProgressNotifier) constructor}). * - * @param output The <code>Stream</code> to write data into. May + * @param output The {@code Stream} to write data into. May * be null, in which case this method is equivalent * to {@link #discardBodyData()}. * @@ -631,8 +631,8 @@ public class MultipartStream { } /** - * <p> Reads <code>body-data</code> from the current - * <code>encapsulation</code> and discards it. + * <p> Reads {@code body-data} from the current + * {@code encapsulation} and discards it. * * <p>Use this method to skip encapsulations you don't need or don't * understand. @@ -647,9 +647,9 @@ public class MultipartStream { } /** - * Finds the beginning of the first <code>encapsulation</code>. + * Finds the beginning of the first {@code encapsulation}. * - * @return <code>true</code> if an <code>encapsulation</code> was found in + * @return {@code true} if an {@code encapsulation} was found in * the stream. * * @throws IOException if an i/o error occurs. @@ -679,15 +679,15 @@ public class MultipartStream { } /** - * Compares <code>count</code> first bytes in the arrays - * <code>a</code> and <code>b</code>. + * Compares {@code count} first bytes in the arrays + * {@code a} and {@code b}. * * @param a The first array to compare. * @param b The second array to compare. * @param count How many bytes should be compared. * - * @return <code>true</code> if <code>count</code> first bytes in arrays - * <code>a</code> and <code>b</code> are equal. + * @return {@code true} if {@code count} first bytes in arrays + * {@code a} and {@code b} are equal. */ public static boolean arrayequals(byte[] a, byte[] b, @@ -701,14 +701,14 @@ public class MultipartStream { } /** - * Searches for a byte of specified value in the <code>buffer</code>, - * starting at the specified <code>position</code>. + * Searches for a byte of specified value in the {@code buffer}, + * starting at the specified {@code position}. * * @param value The value to find. * @param pos The starting position for searching. * * @return The position of byte found, counting from beginning of the - * <code>buffer</code>, or <code>-1</code> if not found. + * {@code buffer}, or {@code -1} if not found. */ protected int findByte(byte value, int pos) { @@ -722,11 +722,11 @@ public class MultipartStream { } /** - * Searches for the <code>boundary</code> in the <code>buffer</code> - * region delimited by <code>head</code> and <code>tail</code>. + * Searches for the {@code boundary} in the {@code buffer} + * region delimited by {@code head} and {@code tail}. * * @return The position of the boundary found, counting from the - * beginning of the <code>buffer</code>, or <code>-1</code> if + * beginning of the {@code buffer}, or {@code -1} if * not found. */ protected int findSeparator() { @@ -759,7 +759,7 @@ public class MultipartStream { private static final long serialVersionUID = 6466926458059796677L; /** - * Constructs a <code>MalformedStreamException</code> with no + * Constructs a {@code MalformedStreamException} with no * detail message. */ public MalformedStreamException() { @@ -767,7 +767,7 @@ public class MultipartStream { } /** - * Constructs an <code>MalformedStreamException</code> with + * Constructs an {@code MalformedStreamException} with * the specified detail message. * * @param message The detail message. @@ -789,7 +789,7 @@ public class MultipartStream { private static final long serialVersionUID = -161533165102632918L; /** - * Constructs an <code>IllegalBoundaryException</code> with no + * Constructs an {@code IllegalBoundaryException} with no * detail message. */ public IllegalBoundaryException() { @@ -797,7 +797,7 @@ public class MultipartStream { } /** - * Constructs an <code>IllegalBoundaryException</code> with + * Constructs an {@code IllegalBoundaryException} with * the specified detail message. * * @param message The detail message. diff --git a/src/main/java/org/apache/commons/fileupload2/ParameterParser.java b/src/main/java/org/apache/commons/fileupload2/ParameterParser.java index 314519d..bc3321e 100644 --- a/src/main/java/org/apache/commons/fileupload2/ParameterParser.java +++ b/src/main/java/org/apache/commons/fileupload2/ParameterParser.java @@ -31,7 +31,7 @@ import org.apache.commons.fileupload2.util.mime.MimeUtility; * Parameter values are optional and can be omitted. * * <p> - * <code>param1 = value; param2 = "anything goes; really"; param3</code> + * {@code param1 = value; param2 = "anything goes; really"; param3} * </p> */ public class ParameterParser { diff --git a/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItem.java b/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItem.java index b76bb75..539802f 100644 --- a/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItem.java +++ b/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItem.java @@ -100,7 +100,7 @@ public class DiskFileItem private String fieldName; /** - * The content type passed by the browser, or <code>null</code> if + * The content type passed by the browser, or {@code null} if * not defined. */ private final String contentType; @@ -161,15 +161,15 @@ public class DiskFileItem // ----------------------------------------------------------- Constructors /** - * Constructs a new <code>DiskFileItem</code> instance. + * Constructs a new {@code DiskFileItem} instance. * * @param fieldName The name of the form field. * @param contentType The content type passed by the browser or - * <code>null</code> if not specified. + * {@code null} if not specified. * @param isFormField Whether or not this item is a plain form field, as * opposed to a file upload. * @param fileName The original file name in the user's file system, or - * <code>null</code> if not specified. + * {@code null} if not specified. * @param sizeThreshold The threshold, in bytes, below which items will be * retained in memory and above which they will be * stored as a file. @@ -213,10 +213,10 @@ public class DiskFileItem } /** - * Returns the content type passed by the agent or <code>null</code> if + * Returns the content type passed by the agent or {@code null} if * not defined. * - * @return The content type passed by the agent or <code>null</code> if + * @return The content type passed by the agent or {@code null} if * not defined. */ @Override @@ -225,10 +225,10 @@ public class DiskFileItem } /** - * Returns the content charset passed by the agent or <code>null</code> if + * Returns the content charset passed by the agent or {@code null} if * not defined. * - * @return The content charset passed by the agent or <code>null</code> if + * @return The content charset passed by the agent or {@code null} if * not defined. */ public String getCharSet() { @@ -259,8 +259,8 @@ public class DiskFileItem * Provides a hint as to whether or not the file contents will be read * from memory. * - * @return <code>true</code> if the file contents will be read - * from memory; <code>false</code> otherwise. + * @return {@code true} if the file contents will be read + * from memory; {@code false} otherwise. */ @Override public boolean isInMemory() { @@ -376,7 +376,7 @@ public class DiskFileItem * method renames a temporary file, that file will no longer be available * to copy or rename again at a later time. * - * @param file The <code>File</code> into which the uploaded item should + * @param file The {@code File} into which the uploaded item should * be stored. * * @throws Exception if an error occurs. @@ -423,7 +423,7 @@ public class DiskFileItem /** * Deletes the underlying storage for a file item, including deleting any * associated temporary disk file. Although this storage will be deleted - * automatically when the <code>FileItem</code> instance is garbage + * automatically when the {@code FileItem} instance is garbage * collected, this method can be used to ensure that this is done at an * earlier time, thus preserving system resources. */ @@ -464,11 +464,11 @@ public class DiskFileItem } /** - * Determines whether or not a <code>FileItem</code> instance represents + * Determines whether or not a {@code FileItem} instance represents * a simple form field. * - * @return <code>true</code> if the instance represents a simple form - * field; <code>false</code> if it represents an uploaded file. + * @return {@code true} if the instance represents a simple form + * field; {@code false} if it represents an uploaded file. * * @see #setFormField(boolean) * @@ -479,11 +479,11 @@ public class DiskFileItem } /** - * Specifies whether or not a <code>FileItem</code> instance represents + * Specifies whether or not a {@code FileItem} instance represents * a simple form field. * - * @param state <code>true</code> if the instance represents a simple form - * field; <code>false</code> if it represents an uploaded file. + * @param state {@code true} if the instance represents a simple form + * field; {@code false} if it represents an uploaded file. * * @see #isFormField() * @@ -515,16 +515,16 @@ public class DiskFileItem // --------------------------------------------------------- Public methods /** - * Returns the {@link java.io.File} object for the <code>FileItem</code>'s + * Returns the {@link java.io.File} object for the {@code FileItem}'s * data's temporary location on the disk. Note that for - * <code>FileItem</code>s that have their data stored in memory, - * this method will return <code>null</code>. When handling large + * {@code FileItem}s that have their data stored in memory, + * this method will return {@code null}. When handling large * files, you can use {@link java.io.File#renameTo(java.io.File)} to * move the file to new location without copying the data, if the * source and destination locations reside within the same logical * volume. * - * @return The data file, or <code>null</code> if the data is stored in + * @return The data file, or {@code null} if the data is stored in * memory. */ public File getStoreLocation() { @@ -558,7 +558,7 @@ public class DiskFileItem /** * Creates and returns a {@link java.io.File File} representing a uniquely * named temporary file in the configured repository path. The lifetime of - * the file is tied to the lifetime of the <code>FileItem</code> instance; + * the file is tied to the lifetime of the {@code FileItem} instance; * the file will be deleted when the instance is garbage collected. * <p> * <b>Note: Subclasses that override this method must ensure that they return the diff --git a/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItemFactory.java b/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItemFactory.java index 7add618..3091121 100644 --- a/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItemFactory.java +++ b/src/main/java/org/apache/commons/fileupload2/disk/DiskFileItemFactory.java @@ -36,7 +36,7 @@ import org.apache.commons.io.FileCleaningTracker; * <ul> * <li>Size threshold is 10KB.</li> * <li>Repository is the system default temp directory, as returned by - * <code>System.getProperty("java.io.tmpdir")</code>.</li> + * {@code System.getProperty("java.io.tmpdir")}.</li> * </ul> * <p> * <b>NOTE</b>: Files are created in the system default temp directory with @@ -47,7 +47,7 @@ import org.apache.commons.io.FileCleaningTracker; * implementation in an environment with local, untrusted users, * {@link #setRepository(File)} MUST be used to configure a repository location * that is not publicly writable. In a Servlet container the location identified - * by the ServletContext attribute <code>javax.servlet.context.tempdir</code> + * by the ServletContext attribute {@code javax.servlet.context.tempdir} * may be used. * </p> * @@ -187,8 +187,8 @@ public class DiskFileItemFactory implements FileItemFactory { * * @param fieldName The name of the form field. * @param contentType The content type of the form field. - * @param isFormField <code>true</code> if this is a plain form field; - * <code>false</code> otherwise. + * @param isFormField {@code true} if this is a plain form field; + * {@code false} otherwise. * @param fileName The name of the uploaded file, if any, as supplied * by the browser or other client. * diff --git a/src/main/java/org/apache/commons/fileupload2/impl/FileItemIteratorImpl.java b/src/main/java/org/apache/commons/fileupload2/impl/FileItemIteratorImpl.java index 1fc7185..0fb381b 100644 --- a/src/main/java/org/apache/commons/fileupload2/impl/FileItemIteratorImpl.java +++ b/src/main/java/org/apache/commons/fileupload2/impl/FileItemIteratorImpl.java @@ -111,18 +111,19 @@ public class FileItemIteratorImpl implements FileItemIterator { /** * Creates a new instance. - * - * @param ctx The request context. + * + * @param fileUploadBase Main processor. + * @param requestContext The request context. * @throws FileUploadException An error occurred while * parsing the request. * @throws IOException An I/O error occurred. */ - public FileItemIteratorImpl(FileUploadBase pFileUploadBase, RequestContext pRequestContext) + public FileItemIteratorImpl(FileUploadBase fileUploadBase, RequestContext requestContext) throws FileUploadException, IOException { - fileUploadBase = pFileUploadBase; + this.fileUploadBase = fileUploadBase; sizeMax = fileUploadBase.getSizeMax(); fileSizeMax = fileUploadBase.getFileSizeMax(); - ctx = pRequestContext; + ctx = requestContext; if (ctx == null) { throw new NullPointerException("ctx parameter"); } diff --git a/src/main/java/org/apache/commons/fileupload2/impl/FileSizeLimitExceededException.java b/src/main/java/org/apache/commons/fileupload2/impl/FileSizeLimitExceededException.java index 096c03c..cb40016 100644 --- a/src/main/java/org/apache/commons/fileupload2/impl/FileSizeLimitExceededException.java +++ b/src/main/java/org/apache/commons/fileupload2/impl/FileSizeLimitExceededException.java @@ -38,7 +38,7 @@ public class FileSizeLimitExceededException private String fieldName; /** - * Constructs a <code>SizeExceededException</code> with + * Constructs a {@code SizeExceededException} with * the specified detail message, and actual and permitted sizes. * * @param message The detail message. diff --git a/src/main/java/org/apache/commons/fileupload2/impl/FileUploadIOException.java b/src/main/java/org/apache/commons/fileupload2/impl/FileUploadIOException.java index e1b214e..6c97a60 100644 --- a/src/main/java/org/apache/commons/fileupload2/impl/FileUploadIOException.java +++ b/src/main/java/org/apache/commons/fileupload2/impl/FileUploadIOException.java @@ -39,7 +39,7 @@ public class FileUploadIOException extends IOException { private final FileUploadException cause; /** - * Creates a <code>FileUploadIOException</code> with the + * Creates a {@code FileUploadIOException} with the * given cause. * * @param pCause The exceptions cause, if any, or null. diff --git a/src/main/java/org/apache/commons/fileupload2/impl/InvalidContentTypeException.java b/src/main/java/org/apache/commons/fileupload2/impl/InvalidContentTypeException.java index e76f311..380f40a 100644 --- a/src/main/java/org/apache/commons/fileupload2/impl/InvalidContentTypeException.java +++ b/src/main/java/org/apache/commons/fileupload2/impl/InvalidContentTypeException.java @@ -30,7 +30,7 @@ public class InvalidContentTypeException private static final long serialVersionUID = -9073026332015646668L; /** - * Constructs a <code>InvalidContentTypeException</code> with no + * Constructs a {@code InvalidContentTypeException} with no * detail message. */ public InvalidContentTypeException() { @@ -38,7 +38,7 @@ public class InvalidContentTypeException } /** - * Constructs an <code>InvalidContentTypeException</code> with + * Constructs an {@code InvalidContentTypeException} with * the specified detail message. * * @param message The detail message. @@ -48,7 +48,7 @@ public class InvalidContentTypeException } /** - * Constructs an <code>InvalidContentTypeException</code> with + * Constructs an {@code InvalidContentTypeException} with * the specified detail message and cause. * * @param msg The detail message. diff --git a/src/main/java/org/apache/commons/fileupload2/impl/SizeLimitExceededException.java b/src/main/java/org/apache/commons/fileupload2/impl/SizeLimitExceededException.java index 0b34fae..efd5d0b 100644 --- a/src/main/java/org/apache/commons/fileupload2/impl/SizeLimitExceededException.java +++ b/src/main/java/org/apache/commons/fileupload2/impl/SizeLimitExceededException.java @@ -28,7 +28,7 @@ public class SizeLimitExceededException private static final long serialVersionUID = -2474893167098052828L; /** - * Constructs a <code>SizeExceededException</code> with + * Constructs a {@code SizeExceededException} with * the specified detail message, and actual and permitted sizes. * * @param message The detail message. diff --git a/src/main/java/org/apache/commons/fileupload2/impl/UnknownSizeException.java b/src/main/java/org/apache/commons/fileupload2/impl/UnknownSizeException.java index f4068df..06463c7 100644 --- a/src/main/java/org/apache/commons/fileupload2/impl/UnknownSizeException.java +++ b/src/main/java/org/apache/commons/fileupload2/impl/UnknownSizeException.java @@ -36,7 +36,7 @@ public class UnknownSizeException private static final long serialVersionUID = 7062279004812015273L; /** - * Constructs a <code>UnknownSizeException</code> with no + * Constructs a {@code UnknownSizeException} with no * detail message. */ public UnknownSizeException() { @@ -44,7 +44,7 @@ public class UnknownSizeException } /** - * Constructs an <code>UnknownSizeException</code> with + * Constructs an {@code UnknownSizeException} with * the specified detail message. * * @param message The detail message. diff --git a/src/main/java/org/apache/commons/fileupload2/package-info.java b/src/main/java/org/apache/commons/fileupload2/package-info.java index 4866753..e91d991 100644 --- a/src/main/java/org/apache/commons/fileupload2/package-info.java +++ b/src/main/java/org/apache/commons/fileupload2/package-info.java @@ -67,7 +67,7 @@ * </pre> * <p> * In the example above, the first file is loaded into memory as a - * <code>String</code>. Before calling the <code>getString</code> method, + * {@code String}. Before calling the {@code getString} method, * the data may have been in memory or on disk depending on its size. The * second file we assume it will be large and therefore never explicitly * load it into memory, though if it is less than 4096 bytes it will be diff --git a/src/main/java/org/apache/commons/fileupload2/portlet/PortletFileUpload.java b/src/main/java/org/apache/commons/fileupload2/portlet/PortletFileUpload.java index c037084..084aac7 100644 --- a/src/main/java/org/apache/commons/fileupload2/portlet/PortletFileUpload.java +++ b/src/main/java/org/apache/commons/fileupload2/portlet/PortletFileUpload.java @@ -33,7 +33,7 @@ import org.apache.commons.fileupload2.FileUploadException; * <p>High level API for processing file uploads.</p> * * <p>This class handles multiple files per single HTML widget, sent using - * <code>multipart/mixed</code> encoding type, as specified by + * {@code multipart/mixed} encoding type, as specified by * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>. Use * {@link org.apache.commons.fileupload2.servlet.ServletFileUpload * #parseRequest(javax.servlet.http.HttpServletRequest)} to acquire a list @@ -56,8 +56,8 @@ public class PortletFileUpload extends FileUpload { * * @param request The portlet request to be evaluated. Must be non-null. * - * @return <code>true</code> if the request is multipart; - * <code>false</code> otherwise. + * @return {@code true} if the request is multipart; + * {@code false} otherwise. */ public static final boolean isMultipartContent(ActionRequest request) { return FileUploadBase.isMultipartContent( @@ -68,7 +68,7 @@ public class PortletFileUpload extends FileUpload { /** * Constructs an uninitialised instance of this class. A factory must be - * configured, using <code>setFileItemFactory()</code>, before attempting + * configured, using {@code setFileItemFactory()}, before attempting * to parse requests. * * @see FileUpload#FileUpload(FileItemFactory) @@ -79,7 +79,7 @@ public class PortletFileUpload extends FileUpload { /** * Constructs an instance of this class which uses the supplied factory to - * create <code>FileItem</code> instances. + * create {@code FileItem} instances. * * @see FileUpload#FileUpload() * @param fileItemFactory The factory to use for creating file items. @@ -92,11 +92,11 @@ public class PortletFileUpload extends FileUpload { /** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> - * compliant <code>multipart/form-data</code> stream. + * compliant {@code multipart/form-data} stream. * * @param request The portlet request to be parsed. * - * @return A list of <code>FileItem</code> instances parsed from the + * @return A list of {@code FileItem} instances parsed from the * request, in the order that they were transmitted. * * @throws FileUploadException if there are problems reading/parsing @@ -109,11 +109,11 @@ public class PortletFileUpload extends FileUpload { /** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> - * compliant <code>multipart/form-data</code> stream. + * compliant {@code multipart/form-data} stream. * * @param request The portlet request to be parsed. * - * @return A map of <code>FileItem</code> instances parsed from the request. + * @return A map of {@code FileItem} instances parsed from the request. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. @@ -127,11 +127,11 @@ public class PortletFileUpload extends FileUpload { /** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> - * compliant <code>multipart/form-data</code> stream. + * compliant {@code multipart/form-data} stream. * * @param request The portlet request to be parsed. * - * @return An iterator to instances of <code>FileItemStream</code> + * @return An iterator to instances of {@code FileItemStream} * parsed from the request, in the order that they were * transmitted. * diff --git a/src/main/java/org/apache/commons/fileupload2/portlet/package-info.java b/src/main/java/org/apache/commons/fileupload2/portlet/package-info.java index 773f62b..bb1b281 100644 --- a/src/main/java/org/apache/commons/fileupload2/portlet/package-info.java +++ b/src/main/java/org/apache/commons/fileupload2/portlet/package-info.java @@ -20,7 +20,7 @@ * An implementation of * {@link org.apache.commons.fileupload2.FileUpload FileUpload} * for use in portlets conforming to JSR 168. This implementation requires - * only access to the portlet's current <code>ActionRequest</code> instance, + * only access to the portlet's current {@code ActionRequest} instance, * and a suitable * {@link org.apache.commons.fileupload2.FileItemFactory FileItemFactory} * implementation, such as diff --git a/src/main/java/org/apache/commons/fileupload2/servlet/ServletFileUpload.java b/src/main/java/org/apache/commons/fileupload2/servlet/ServletFileUpload.java index 933d526..23f6164 100644 --- a/src/main/java/org/apache/commons/fileupload2/servlet/ServletFileUpload.java +++ b/src/main/java/org/apache/commons/fileupload2/servlet/ServletFileUpload.java @@ -33,7 +33,7 @@ import org.apache.commons.fileupload2.FileUploadException; * <p>High level API for processing file uploads.</p> * * <p>This class handles multiple files per single HTML widget, sent using - * <code>multipart/mixed</code> encoding type, as specified by + * {@code multipart/mixed} encoding type, as specified by * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>. Use {@link * #parseRequest(HttpServletRequest)} to acquire a list of {@link * org.apache.commons.fileupload2.FileItem}s associated with a given HTML @@ -58,8 +58,8 @@ public class ServletFileUpload extends FileUpload { * * @param request The servlet request to be evaluated. Must be non-null. * - * @return <code>true</code> if the request is multipart; - * <code>false</code> otherwise. + * @return {@code true} if the request is multipart; + * {@code false} otherwise. */ public static final boolean isMultipartContent( HttpServletRequest request) { @@ -73,7 +73,7 @@ public class ServletFileUpload extends FileUpload { /** * Constructs an uninitialised instance of this class. A factory must be - * configured, using <code>setFileItemFactory()</code>, before attempting + * configured, using {@code setFileItemFactory()}, before attempting * to parse requests. * * @see FileUpload#FileUpload(FileItemFactory) @@ -84,7 +84,7 @@ public class ServletFileUpload extends FileUpload { /** * Constructs an instance of this class which uses the supplied factory to - * create <code>FileItem</code> instances. + * create {@code FileItem} instances. * * @see FileUpload#FileUpload() * @param fileItemFactory The factory to use for creating file items. @@ -97,11 +97,11 @@ public class ServletFileUpload extends FileUpload { /** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> - * compliant <code>multipart/form-data</code> stream. + * compliant {@code multipart/form-data} stream. * * @param request The servlet request to be parsed. * - * @return A list of <code>FileItem</code> instances parsed from the + * @return A list of {@code FileItem} instances parsed from the * request, in the order that they were transmitted. * * @throws FileUploadException if there are problems reading/parsing @@ -115,11 +115,11 @@ public class ServletFileUpload extends FileUpload { /** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> - * compliant <code>multipart/form-data</code> stream. + * compliant {@code multipart/form-data} stream. * * @param request The servlet request to be parsed. * - * @return A map of <code>FileItem</code> instances parsed from the request. + * @return A map of {@code FileItem} instances parsed from the request. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. @@ -133,11 +133,11 @@ public class ServletFileUpload extends FileUpload { /** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> - * compliant <code>multipart/form-data</code> stream. + * compliant {@code multipart/form-data} stream. * * @param request The servlet request to be parsed. * - * @return An iterator to instances of <code>FileItemStream</code> + * @return An iterator to instances of {@code FileItemStream} * parsed from the request, in the order that they were * transmitted. * diff --git a/src/main/java/org/apache/commons/fileupload2/servlet/package-info.java b/src/main/java/org/apache/commons/fileupload2/servlet/package-info.java index ac0d885..d1050fa 100644 --- a/src/main/java/org/apache/commons/fileupload2/servlet/package-info.java +++ b/src/main/java/org/apache/commons/fileupload2/servlet/package-info.java @@ -20,7 +20,7 @@ * An implementation of * {@link org.apache.commons.fileupload2.FileUpload FileUpload} * for use in servlets conforming to JSR 53. This implementation requires - * only access to the servlet's current <code>HttpServletRequest</code> + * only access to the servlet's current {@code HttpServletRequest} * instance, and a suitable * {@link org.apache.commons.fileupload2.FileItemFactory FileItemFactory} * implementation, such as diff --git a/src/main/java/org/apache/commons/fileupload2/util/FileItemHeadersImpl.java b/src/main/java/org/apache/commons/fileupload2/util/FileItemHeadersImpl.java index fde5700..4dfc8ef 100644 --- a/src/main/java/org/apache/commons/fileupload2/util/FileItemHeadersImpl.java +++ b/src/main/java/org/apache/commons/fileupload2/util/FileItemHeadersImpl.java @@ -40,8 +40,8 @@ public class FileItemHeadersImpl implements FileItemHeaders, Serializable { private static final long serialVersionUID = -4455695752627032559L; /** - * Map of <code>String</code> keys to a <code>List</code> of - * <code>String</code> instances. + * Map of {@code String} keys to a {@code List} of + * {@code String} instances. */ private final Map<String, List<String>> headerNameToValueListMap = new LinkedHashMap<String, List<String>>(); diff --git a/src/main/java/org/apache/commons/fileupload2/util/LimitedInputStream.java b/src/main/java/org/apache/commons/fileupload2/util/LimitedInputStream.java index 626afe6..ccc162f 100644 --- a/src/main/java/org/apache/commons/fileupload2/util/LimitedInputStream.java +++ b/src/main/java/org/apache/commons/fileupload2/util/LimitedInputStream.java @@ -79,17 +79,17 @@ public abstract class LimitedInputStream extends FilterInputStream implements Cl /** * Reads the next byte of data from this input stream. The value - * byte is returned as an <code>int</code> in the range - * <code>0</code> to <code>255</code>. If no byte is available + * byte is returned as an {@code int} in the range + * {@code 0} to {@code 255}. If no byte is available * because the end of the stream has been reached, the value - * <code>-1</code> is returned. This method blocks until input data + * {@code -1} is returned. This method blocks until input data * is available, the end of the stream is detected, or an exception * is thrown. * <p> * This method - * simply performs <code>in.read()</code> and returns the result. + * simply performs {@code in.read()} and returns the result. * - * @return the next byte of data, or <code>-1</code> if the end of the + * @return the next byte of data, or {@code -1} if the end of the * stream is reached. * @throws IOException if an I/O error occurs. * @see java.io.FilterInputStream#in @@ -105,25 +105,25 @@ public abstract class LimitedInputStream extends FilterInputStream implements Cl } /** - * Reads up to <code>len</code> bytes of data from this input stream - * into an array of bytes. If <code>len</code> is not zero, the method + * Reads up to {@code len} bytes of data from this input stream + * into an array of bytes. If {@code len} is not zero, the method * blocks until some input is available; otherwise, no - * bytes are read and <code>0</code> is returned. + * bytes are read and {@code 0} is returned. * <p> - * This method simply performs <code>in.read(b, off, len)</code> + * This method simply performs {@code in.read(b, off, len)} * and returns the result. * * @param b the buffer into which the data is read. * @param off The start offset in the destination array - * <code>b</code>. + * {@code b}. * @param len the maximum number of bytes read. * @return the total number of bytes read into the buffer, or - * <code>-1</code> if there is no more data because the end of + * {@code -1} if there is no more data because the end of * the stream has been reached. - * @throws NullPointerException If <code>b</code> is <code>null</code>. - * @throws IndexOutOfBoundsException If <code>off</code> is negative, - * <code>len</code> is negative, or <code>len</code> is greater than - * <code>b.length - off</code> + * @throws NullPointerException If {@code b} is {@code null}. + * @throws IndexOutOfBoundsException If {@code off} is negative, + * {@code len} is negative, or {@code len} is greater than + * {@code b.length - off} * @throws IOException if an I/O error occurs. * @see java.io.FilterInputStream#in */ @@ -152,7 +152,7 @@ public abstract class LimitedInputStream extends FilterInputStream implements Cl * Closes this input stream and releases any system resources * associated with the stream. * This - * method simply performs <code>in.close()</code>. + * method simply performs {@code in.close()}. * * @throws IOException if an I/O error occurs. * @see java.io.FilterInputStream#in diff --git a/src/test/java/org/apache/commons/fileupload2/DefaultFileItemTest.java b/src/test/java/org/apache/commons/fileupload2/DefaultFileItemTest.java index 1822789..902ee50 100644 --- a/src/test/java/org/apache/commons/fileupload2/DefaultFileItemTest.java +++ b/src/test/java/org/apache/commons/fileupload2/DefaultFileItemTest.java @@ -206,12 +206,12 @@ public class DefaultFileItemTest { /** - * Creates a new <code>FileItemFactory</code> and returns it, obscuring + * Creates a new {@code FileItemFactory} and returns it, obscuring * from the caller the underlying implementation of this interface. * * @param repository The directory within which temporary files will be * created. - * @return the new <code>FileItemFactory</code> instance. + * @return the new {@code FileItemFactory} instance. */ protected FileItemFactory createFactory(File repository) { return new DefaultFileItemFactory(threshold, repository);