You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/05/28 22:29:16 UTC

svn commit: r1682324 - in /tomcat/trunk/java/org/apache/tomcat/util/http/fileupload: ./ FileUploadBase.java ParameterParser.java disk/DiskFileItem.java

Author: markt
Date: Thu May 28 20:29:15 2015
New Revision: 1682324

URL: http://svn.apache.org/r1682324
Log:
Update fork of Commons FileUpload from r1596086 to r1682322 to pick thew 1.3.1 release and subsequent fixes.

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/ParameterParser.java
    tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java

Propchange: tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 28 20:29:15 2015
@@ -1 +1 @@
-/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload:1-1596086
+/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload:1-1682322

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=1682324&r1=1682323&r2=1682324&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 Thu May 28 20:29:15 2015
@@ -311,8 +311,8 @@ public abstract class FileUploadBase {
                 for (FileItem fileItem : items) {
                     try {
                         fileItem.delete();
-                    } catch (Exception e) {
-                        // ignore it
+                    } catch (Exception ignored) {
+                        // ignored TODO perhaps add to tracker delete failure list somehow?
                     }
                 }
             }

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/ParameterParser.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/ParameterParser.java?rev=1682324&r1=1682323&r2=1682324&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/ParameterParser.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/ParameterParser.java Thu May 28 20:29:15 2015
@@ -76,8 +76,8 @@ public class ParameterParser {
     /**
      * Are there any characters left to parse?
      *
-     * @return <tt>true</tt> if there are unparsed characters,
-     *         <tt>false</tt> otherwise.
+     * @return {@code true} if there are unparsed characters,
+     *         {@code false} otherwise.
      */
     private boolean hasChar() {
         return this.pos < this.len;
@@ -88,8 +88,8 @@ public class ParameterParser {
      * leading and trailing blanks as well as enclosing quotation marks,
      * when necessary.
      *
-     * @param quoted <tt>true</tt> if quotation marks are expected,
-     *               <tt>false</tt> otherwise.
+     * @param quoted {@code true} if quotation marks are expected,
+     *               {@code false} otherwise.
      * @return the token
      */
     private String getToken(boolean quoted) {
@@ -122,8 +122,8 @@ public class ParameterParser {
      * @param ch the character to test for presense in the array of characters
      * @param charray the array of characters to test against
      *
-     * @return <tt>true</tt> if the character is present in the array of
-     *   characters, <tt>false</tt> otherwise.
+     * @return {@code true} if the character is present in the array of
+     *   characters, {@code false} otherwise.
      */
     private boolean isOneOf(char ch, final char[] charray) {
         boolean result = false;
@@ -193,12 +193,12 @@ public class ParameterParser {
     }
 
     /**
-     * Returns <tt>true</tt> if parameter names are to be converted to lower
+     * Returns {@code true} if parameter names are to be converted to lower
      * case when name/value pairs are parsed.
      *
-     * @return <tt>true</tt> if parameter names are to be
+     * @return {@code true} if parameter names are to be
      * converted to lower case when name/value pairs are parsed.
-     * Otherwise returns <tt>false</tt>
+     * Otherwise returns {@code false}
      */
     public boolean isLowerCaseNames() {
         return this.lowerCaseNames;
@@ -208,9 +208,9 @@ public class ParameterParser {
      * Sets the flag if parameter names are to be converted to lower case when
      * name/value pairs are parsed.
      *
-     * @param b <tt>true</tt> if parameter names are to be
+     * @param b {@code true} if parameter names are to be
      * converted to lower case when name/value pairs are parsed.
-     * <tt>false</tt> otherwise.
+     * {@code false} otherwise.
      */
     public void setLowerCaseNames(boolean b) {
         this.lowerCaseNames = b;

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=1682324&r1=1682323&r2=1682324&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 Thu May 28 20:29:15 2015
@@ -371,10 +371,9 @@ public class DiskFileItem
             try {
                 fout = new FileOutputStream(file);
                 fout.write(get());
+                fout.close();
             } finally {
-                if (fout != null) {
-                    fout.close();
-                }
+                IOUtils.closeQuietly(fout);
             }
         } else {
             File outputFile = getStoreLocation();
@@ -490,7 +489,7 @@ public class DiskFileItem
      * be used for storing the contents of the file.
      *
      * @return An {@link java.io.OutputStream OutputStream} that can be used
-     *         for storing the contensts of the file.
+     *         for storing the contents of the file.
      *
      * @throws IOException if an error occurs.
      */
@@ -523,6 +522,9 @@ public class DiskFileItem
         if (dfos == null) {
             return null;
         }
+        if (isInMemory()) {
+            return null;
+        }
         return dfos.getFile();
     }
 
@@ -573,7 +575,7 @@ public class DiskFileItem
 
     /**
      * Returns an identifier that is unique within the class loader used to
-     * load this class, but does not have random-like apearance.
+     * load this class, but does not have random-like appearance.
      *
      * @return A String with the non-random looking instance identifier.
      */



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