You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2013/03/07 13:42:22 UTC

svn commit: r1453817 - /commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/FileUploadBase.java

Author: simonetripodi
Date: Thu Mar  7 12:42:21 2013
New Revision: 1453817

URL: http://svn.apache.org/r1453817
Log:
trivial: javadoc/code format, no functional modifications

Modified:
    commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/FileUploadBase.java

Modified: commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/FileUploadBase.java
URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/FileUploadBase.java?rev=1453817&r1=1453816&r2=1453817&view=diff
==============================================================================
--- commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/FileUploadBase.java (original)
+++ commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/FileUploadBase.java Thu Mar  7 12:42:21 2013
@@ -65,7 +65,6 @@ public abstract class FileUploadBase {
 
     // ---------------------------------------------------------- Class methods
 
-
     /**
      * <p>Utility method that determines whether the request contains multipart
      * content.</p>
@@ -91,7 +90,6 @@ public abstract class FileUploadBase {
         return false;
     }
 
-
     /**
      * Utility method that determines whether the request contains multipart
      * content.
@@ -108,16 +106,13 @@ public abstract class FileUploadBase {
         return ServletFileUpload.isMultipartContent(req);
     }
 
-
     // ----------------------------------------------------- Manifest constants
 
-
     /**
      * HTTP content type header name.
      */
     public static final String CONTENT_TYPE = "Content-type";
 
-
     /**
      * HTTP content disposition header name.
      */
@@ -128,37 +123,31 @@ public abstract class FileUploadBase {
      */
     public static final String CONTENT_LENGTH = "Content-length";
 
-
     /**
      * Content-disposition value for form data.
      */
     public static final String FORM_DATA = "form-data";
 
-
     /**
      * Content-disposition value for file attachment.
      */
     public static final String ATTACHMENT = "attachment";
 
-
     /**
      * Part of HTTP content type header.
      */
     public static final String MULTIPART = "multipart/";
 
-
     /**
      * HTTP content type header for multipart forms.
      */
     public static final String MULTIPART_FORM_DATA = "multipart/form-data";
 
-
     /**
      * HTTP content type header for multiple uploads.
      */
     public static final String MULTIPART_MIXED = "multipart/mixed";
 
-
     /**
      * The maximum length of a single header line that will be parsed
      * (1024 bytes).
@@ -169,10 +158,8 @@ public abstract class FileUploadBase {
     @Deprecated
     public static final int MAX_HEADER_SIZE = 1024;
 
-
     // ----------------------------------------------------------- Data members
 
-
     /**
      * The maximum size permitted for the complete request, as opposed to
      * {@link #fileSizeMax}. A value of -1 indicates no maximum.
@@ -197,7 +184,6 @@ public abstract class FileUploadBase {
 
     // ----------------------------------------------------- Property accessors
 
-
     /**
      * Returns the factory class used when creating file items.
      *
@@ -205,7 +191,6 @@ public abstract class FileUploadBase {
      */
     public abstract FileItemFactory getFileItemFactory();
 
-
     /**
      * Sets the factory class to use when creating file items.
      *
@@ -213,7 +198,6 @@ public abstract class FileUploadBase {
      */
     public abstract void setFileItemFactory(FileItemFactory factory);
 
-
     /**
      * Returns the maximum allowed size of a complete request, as opposed
      * to {@link #getFileSizeMax()}.
@@ -228,7 +212,6 @@ public abstract class FileUploadBase {
         return sizeMax;
     }
 
-
     /**
      * Sets the maximum allowed size of a complete request, as opposed
      * to {@link #setFileSizeMax(long)}.
@@ -277,7 +260,6 @@ public abstract class FileUploadBase {
         return headerEncoding;
     }
 
-
     /**
      * Specifies the character encoding to be used when reading the headers of
      * individual part. When not specified, or <code>null</code>, the request
@@ -290,10 +272,8 @@ public abstract class FileUploadBase {
         headerEncoding = encoding;
     }
 
-
     // --------------------------------------------------------- Public methods
 
-
     /**
      * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
      * compliant <code>multipart/form-data</code> stream.
@@ -399,10 +379,8 @@ public abstract class FileUploadBase {
         }
     }
 
-
     // ------------------------------------------------------ Protected methods
 
-
     /**
      * Retrieves the boundary from the <code>Content-type</code> header.
      *
@@ -430,7 +408,6 @@ public abstract class FileUploadBase {
         return boundary;
     }
 
-
     /**
      * Retrieves the file name from the <code>Content-disposition</code>
      * header.
@@ -487,7 +464,6 @@ public abstract class FileUploadBase {
         return fileName;
     }
 
-
     /**
      * Retrieves the field name from the <code>Content-disposition</code>
      * header.
@@ -536,7 +512,6 @@ public abstract class FileUploadBase {
         return getFieldName(getHeader(headers, CONTENT_DISPOSITION));
     }
 
-
     /**
      * Creates a new {@link FileItem} instance.
      *
@@ -705,34 +680,50 @@ public abstract class FileUploadBase {
      * {@link FileUploadBase#getItemIterator(RequestContext)}.
      */
     private class FileItemIteratorImpl implements FileItemIterator {
+
         /**
          * Default implementation of {@link FileItemStream}.
          */
         class FileItemStreamImpl implements FileItemStream {
-            /** The file items content type.
+
+            /**
+             * The file items content type.
              */
             private final String contentType;
-            /** The file items field name.
+
+            /**
+             * The file items field name.
              */
             private final String fieldName;
-            /** The file items file name.
+
+            /**
+             * The file items file name.
              */
             private final String name;
-            /** Whether the file item is a form field.
+
+            /**
+             * Whether the file item is a form field.
              */
             private final boolean formField;
-            /** The file items input stream.
+
+            /**
+             * The file items input stream.
              */
             private final InputStream stream;
-            /** Whether the file item was already opened.
+
+            /**
+             * Whether the file item was already opened.
              */
             private boolean opened;
-            /** The headers, if any.
+
+            /**
+             * The headers, if any.
              */
             private FileItemHeaders headers;
 
             /**
              * Creates a new instance.
+             *
              * @param pName The items file name, or null.
              * @param pFieldName The items field name.
              * @param pContentType The items content type, or null.
@@ -773,7 +764,7 @@ public abstract class FileUploadBase {
                                     pCount, pSizeMax);
                             e.setFieldName(fieldName);
                             e.setFileName(name);
-                    		throw new FileUploadIOException(e);
+                            throw new FileUploadIOException(e);
                         }
                     };
                 }
@@ -782,6 +773,7 @@ public abstract class FileUploadBase {
 
             /**
              * Returns the items content type, or null.
+             *
              * @return Content type, if known, or null.
              */
             public String getContentType() {
@@ -790,6 +782,7 @@ public abstract class FileUploadBase {
 
             /**
              * Returns the items field name.
+             *
              * @return Field name.
              */
             public String getFieldName() {
@@ -798,6 +791,7 @@ public abstract class FileUploadBase {
 
             /**
              * Returns the items file name.
+             *
              * @return File name, if known, or null.
              * @throws InvalidFileNameException The file name contains a NUL character,
              *   which might be an indicator of a security attack. If you intend to
@@ -810,6 +804,7 @@ public abstract class FileUploadBase {
 
             /**
              * Returns, whether this is a form field.
+             *
              * @return True, if the item is a form field,
              *   otherwise false.
              */
@@ -820,6 +815,7 @@ public abstract class FileUploadBase {
             /**
              * Returns an input stream, which may be used to
              * read the items contents.
+             *
              * @return Opened input stream.
              * @throws IOException An I/O error occurred.
              */
@@ -836,6 +832,7 @@ public abstract class FileUploadBase {
 
             /**
              * Closes the file item.
+             *
              * @throws IOException An I/O error occurred.
              */
             void close() throws IOException {
@@ -844,6 +841,7 @@ public abstract class FileUploadBase {
 
             /**
              * Returns the file item headers.
+             *
              * @return The items header object
              */
             public FileItemHeaders getHeaders() {
@@ -852,42 +850,51 @@ public abstract class FileUploadBase {
 
             /**
              * Sets the file item headers.
+             *
              * @param pHeaders The items header object
              */
             public void setHeaders(FileItemHeaders pHeaders) {
                 headers = pHeaders;
             }
+
         }
 
         /**
          * The multi part stream to process.
          */
         private final MultipartStream multi;
+
         /**
          * The notifier, which used for triggering the
          * {@link ProgressListener}.
          */
         private final MultipartStream.ProgressNotifier notifier;
+
         /**
          * The boundary, which separates the various parts.
          */
         private final byte[] boundary;
+
         /**
          * The item, which we currently process.
          */
         private FileItemStreamImpl currentItem;
+
         /**
          * The current items field name.
          */
         private String currentFieldName;
+
         /**
          * Whether we are currently skipping the preamble.
          */
         private boolean skipPreamble;
+
         /**
          * Whether the current item may still be read.
          */
         private boolean itemValid;
+
         /**
          * Whether we have seen the end of the file.
          */
@@ -895,6 +902,7 @@ public abstract class FileUploadBase {
 
         /**
          * Creates a new instance.
+         *
          * @param ctx The request context.
          * @throws FileUploadException An error occurred while
          *   parsing the request.
@@ -960,7 +968,8 @@ public abstract class FileUploadBase {
         }
 
         /**
-         * Called for finding the nex item, if any.
+         * Called for finding the next item, if any.
+         *
          * @return True, if an next item was found, otherwise false.
          * @throws IOException An I/O error occurred.
          */
@@ -1043,6 +1052,7 @@ public abstract class FileUploadBase {
         /**
          * Returns, whether another instance of {@link FileItemStream}
          * is available.
+         *
          * @throws FileUploadException Parsing or processing the
          *   file item failed.
          * @throws IOException Reading the file item failed.
@@ -1061,6 +1071,7 @@ public abstract class FileUploadBase {
 
         /**
          * Returns the next available {@link FileItemStream}.
+         *
          * @throws java.util.NoSuchElementException No more items are
          *   available. Use {@link #hasNext()} to prevent this exception.
          * @throws FileUploadException Parsing or processing the
@@ -1076,6 +1087,7 @@ public abstract class FileUploadBase {
             itemValid = false;
             return currentItem;
         }
+
     }
 
     /**
@@ -1083,10 +1095,14 @@ public abstract class FileUploadBase {
      * {@link FileUploadException} in an {@link IOException}.
      */
     public static class FileUploadIOException extends IOException {
-        /** The exceptions UID, for serializing an instance.
+
+        /**
+         * The exceptions UID, for serializing an instance.
          */
         private static final long serialVersionUID = -7047616958165584154L;
-        /** The exceptions cause; we overwrite the parent
+
+        /**
+         * The exceptions cause; we overwrite the parent
          * classes field, which is available since Java
          * 1.4 only.
          */
@@ -1095,6 +1111,7 @@ public abstract class FileUploadBase {
         /**
          * Creates a <code>FileUploadIOException</code> with the
          * given cause.
+         *
          * @param pCause The exceptions cause, if any, or null.
          */
         public FileUploadIOException(FileUploadException pCause) {
@@ -1104,12 +1121,14 @@ public abstract class FileUploadBase {
 
         /**
          * Returns the exceptions cause.
+         *
          * @return The exceptions cause, if any, or null.
          */
         @Override
         public Throwable getCause() {
             return cause;
         }
+
     }
 
     /**
@@ -1117,7 +1136,9 @@ public abstract class FileUploadBase {
      */
     public static class InvalidContentTypeException
             extends FileUploadException {
-        /** The exceptions UID, for serializing an instance.
+
+        /**
+         * The exceptions UID, for serializing an instance.
          */
         private static final long serialVersionUID = -9073026332015646668L;
 
@@ -1138,16 +1159,21 @@ public abstract class FileUploadBase {
         public InvalidContentTypeException(String message) {
             super(message);
         }
+
     }
 
     /**
      * Thrown to indicate an IOException.
      */
     public static class IOFileUploadException extends FileUploadException {
-        /** The exceptions UID, for serializing an instance.
+
+        /**
+         * The exceptions UID, for serializing an instance.
          */
         private static final long serialVersionUID = 1749796615868477269L;
-        /** The exceptions cause; we overwrite the parent
+
+        /**
+         * The exceptions cause; we overwrite the parent
          * classes field, which is available since Java
          * 1.4 only.
          */
@@ -1155,6 +1181,7 @@ public abstract class FileUploadBase {
 
         /**
          * Creates a new instance with the given cause.
+         *
          * @param pMsg The detail message.
          * @param pException The exceptions cause.
          */
@@ -1165,18 +1192,22 @@ public abstract class FileUploadBase {
 
         /**
          * Returns the exceptions cause.
+         *
          * @return The exceptions cause, if any, or null.
          */
         @Override
         public Throwable getCause() {
             return cause;
         }
+
     }
 
-    /** This exception is thrown, if a requests permitted size
+    /**
+     * This exception is thrown, if a requests permitted size
      * is exceeded.
      */
     protected abstract static class SizeException extends FileUploadException {
+
         private static final long serialVersionUID = -8776225574705254126L;
 
         /**
@@ -1191,6 +1222,7 @@ public abstract class FileUploadBase {
 
         /**
          * Creates a new instance.
+         *
          * @param message The detail message.
          * @param actual The actual number of bytes in the request.
          * @param permitted The requests size limit, in bytes.
@@ -1220,19 +1252,23 @@ public abstract class FileUploadBase {
         public long getPermittedSize() {
             return permitted;
         }
+
     }
 
     /**
      * Thrown to indicate that the request size is not specified. In other
      * words, it is thrown, if the content-length header is missing or
      * contains the value -1.
+     *
      * @deprecated 1.2 As of commons-fileupload 1.2, the presence of a
      *   content-length header is no longer required.
      */
     @Deprecated
     public static class UnknownSizeException
         extends FileUploadException {
-        /** The exceptions UID, for serializing an instance.
+
+        /**
+         * The exceptions UID, for serializing an instance.
          */
         private static final long serialVersionUID = 7062279004812015273L;
 
@@ -1253,6 +1289,7 @@ public abstract class FileUploadBase {
         public UnknownSizeException(String message) {
             super(message);
         }
+
     }
 
     /**
@@ -1260,6 +1297,7 @@ public abstract class FileUploadBase {
      */
     public static class SizeLimitExceededException
             extends SizeException {
+
         /**
          * The exceptions UID, for serializing an instance.
          */
@@ -1296,6 +1334,7 @@ public abstract class FileUploadBase {
                 long permitted) {
             super(message, actual, permitted);
         }
+
     }
 
     /**
@@ -1303,7 +1342,9 @@ public abstract class FileUploadBase {
      */
     public static class FileSizeLimitExceededException
             extends SizeException {
-        /** The exceptions UID, for serializing an instance.
+
+        /**
+         * The exceptions UID, for serializing an instance.
          */
         private static final long serialVersionUID = 8150776562029630058L;
 
@@ -1333,10 +1374,11 @@ public abstract class FileUploadBase {
         /**
          * Returns the file name of the item, which caused the
          * exception.
+         *
          * @return File name, if known, or null.
          */
         public String getFileName() {
-        	return fileName;
+            return fileName;
         }
 
         /**
@@ -1344,16 +1386,17 @@ public abstract class FileUploadBase {
          * exception.
          */
         public void setFileName(String pFileName) {
-        	fileName = pFileName;
+            fileName = pFileName;
         }
 
         /**
          * Returns the field name of the item, which caused the
          * exception.
+         *
          * @return Field name, if known, or null.
          */
         public String getFieldName() {
-        	return fieldName;
+            return fieldName;
         }
 
         /**
@@ -1361,12 +1404,14 @@ public abstract class FileUploadBase {
          * exception.
          */
         public void setFieldName(String pFieldName) {
-        	fieldName = pFieldName;
+            fieldName = pFieldName;
         }
+
     }
 
     /**
      * Returns the progress listener.
+     *
      * @return The progress listener, if any, or null.
      */
     public ProgressListener getProgressListener() {
@@ -1375,9 +1420,11 @@ public abstract class FileUploadBase {
 
     /**
      * Sets the progress listener.
+     *
      * @param pListener The progress listener, if any. Defaults to null.
      */
     public void setProgressListener(ProgressListener pListener) {
         listener = pListener;
     }
+
 }