Author: markt
Date: Fri Mar 15 11:21:18 2013
New Revision: 1456899

URL: http://svn.apache.org/r1456899
Log:
Merge updates from Commons FileUpload to r1453844

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/   (props changed)
    tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
    
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/InvalidFileNameException.java
    
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java
    
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/util/FileItemHeadersImpl.java

Propchange: tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/
------------------------------------------------------------------------------
  Merged 
/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload:r1453818-1453844

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java?rev=1456899&r1=1456898&r2=1456899&view=diff
==============================================================================
--- 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java 
Fri Mar 15 11:21:18 2013
@@ -596,10 +596,10 @@ public abstract class FileUploadBase {
                     if (pContentLength != -1
                             &&  pContentLength > fileSizeMax) {
                         FileSizeLimitExceededException e =
-                                new 
FileSizeLimitExceededException(String.format(
-                                        "The field %s exceeds its maximum 
permitted size of %s bytes.",
+                            new FileSizeLimitExceededException(
+                                String.format("The field %s exceeds its 
maximum permitted size of %s bytes.",
                                         fieldName, Long.valueOf(fileSizeMax)),
-                                        pContentLength, fileSizeMax);
+                                pContentLength, fileSizeMax);
                         e.setFileName(pName);
                         e.setFieldName(pFieldName);
                         throw new FileUploadIOException(e);
@@ -610,10 +610,10 @@ public abstract class FileUploadBase {
                                 throws IOException {
                             itemStream.close(true);
                             FileSizeLimitExceededException e =
-                                    new 
FileSizeLimitExceededException(String.format(
-                                            "The field %s exceeds its maximum 
permitted size of %s bytes.",
+                                new FileSizeLimitExceededException(
+                                    String.format("The field %s exceeds its 
maximum permitted size of %s bytes.",
                                            fieldName, Long.valueOf(pSizeMax)),
-                                           pCount, pSizeMax);
+                                    pCount, pSizeMax);
                             e.setFieldName(fieldName);
                             e.setFileName(name);
                             throw new FileUploadIOException(e);
@@ -1039,7 +1039,9 @@ public abstract class FileUploadBase {
      */
     public abstract static class SizeException extends FileUploadException {
 
-
+        /**
+         * Serial version UID, being used, if serialized.
+         */
         private static final long serialVersionUID = -8776225574705254126L;
 
         /**
@@ -1200,6 +1202,8 @@ public abstract class FileUploadBase {
         /**
          * Sets the file name of the item, which caused the
          * exception.
+         *
+         * @param pFileName the file name of the item, which caused the 
exception.
          */
         public void setFileName(String pFileName) {
             fileName = pFileName;
@@ -1218,6 +1222,9 @@ public abstract class FileUploadBase {
         /**
          * Sets the field name of the item, which caused the
          * exception.
+         *
+         * @param pFieldName the field name of the item,
+         *        which caused the exception.
          */
         public void setFieldName(String pFieldName) {
             fieldName = pFieldName;

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/InvalidFileNameException.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/InvalidFileNameException.java?rev=1456899&r1=1456898&r2=1456899&view=diff
==============================================================================
--- 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/InvalidFileNameException.java
 (original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/InvalidFileNameException.java
 Fri Mar 15 11:21:18 2013
@@ -28,8 +28,15 @@ package org.apache.tomcat.util.http.file
  */
 public class InvalidFileNameException extends RuntimeException {
 
+    /**
+     * Serial version UID, being used, if the exception
+     * is serialized.
+     */
     private static final long serialVersionUID = 7922042602454350470L;
 
+    /**
+     * The file name causing the exception.
+     */
     private final String name;
 
     /**
@@ -45,6 +52,8 @@ public class InvalidFileNameException ex
 
     /**
      * Returns the invalid file name.
+     *
+     * @return the invalid file name.
      */
     public String getName() {
         return name;

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java?rev=1456899&r1=1456898&r2=1456899&view=diff
==============================================================================
--- 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java 
Fri Mar 15 11:21:18 2013
@@ -108,7 +108,7 @@ public class DiskFileItem
     /**
      * Counter used in unique identifier generation.
      */
-    private static final AtomicInteger counter = new AtomicInteger(0);
+    private static final AtomicInteger COUNTER = new AtomicInteger(0);
 
     /**
      * The name of the form field as provided by the browser.
@@ -261,7 +261,8 @@ public class DiskFileItem
      * @throws org.apache.tomcat.util.http.fileupload.InvalidFileNameException
      *   The file name contains a NUL character, which might be an indicator of
      *   a security attack. If you intend to use the file name anyways, catch
-     *   the exception and use InvalidFileNameException#getName().
+     *   the exception and use {@link
+     *   
org.apache.tomcat.util.http.fileupload.InvalidFileNameException#getName()}.
      */
     @Override
     public String getName() {
@@ -568,7 +569,10 @@ public class DiskFileItem
      *         memory.
      */
     public File getStoreLocation() {
-        return dfos == null ? null : dfos.getFile();
+        if (dfos == null) {
+            return null;
+        }
+        return dfos.getFile();
     }
 
     // ------------------------------------------------------ Protected methods
@@ -618,7 +622,7 @@ public class DiskFileItem
      */
     private static String getUniqueId() {
         final int limit = 100000000;
-        int current = counter.getAndIncrement();
+        int current = COUNTER.getAndIncrement();
         String id = Integer.toString(current);
 
         // If you manage to get more than 100 million of ids, you'll

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/util/FileItemHeadersImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/util/FileItemHeadersImpl.java?rev=1456899&r1=1456898&r2=1456899&view=diff
==============================================================================
--- 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/util/FileItemHeadersImpl.java
 (original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/util/FileItemHeadersImpl.java
 Fri Mar 15 11:21:18 2013
@@ -36,6 +36,9 @@ import org.apache.tomcat.util.http.fileu
  */
 public class FileItemHeadersImpl implements FileItemHeaders, Serializable {
 
+    /**
+     * Serial version UID, being used, if serialized.
+     */
     private static final long serialVersionUID = -4455695752627032559L;
 
     /**
@@ -45,6 +48,9 @@ public class FileItemHeadersImpl impleme
     private final Map<String,List<String>> headerNameToValueListMap =
             new LinkedHashMap<>();
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public String getHeader(String name) {
         String nameLower = name.toLowerCase(Locale.ENGLISH);
@@ -55,11 +61,17 @@ public class FileItemHeadersImpl impleme
         return headerValueList.get(0);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public Iterator<String> getHeaderNames() {
         return headerNameToValueListMap.keySet().iterator();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public Iterator<String> getHeaders(String name) {
         String nameLower = name.toLowerCase(Locale.ENGLISH);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to