Author: sebb
Date: Tue Dec  2 22:35:50 2014
New Revision: 1643019

URL: http://svn.apache.org/r1643019
Log:
[FILEUPLOAD-242] Do not silently swallow all Throwables.
Instead swallow only Exceptions

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=1643019&r1=1643018&r2=1643019&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
 Tue Dec  2 22:35:50 2014
@@ -366,8 +366,8 @@ public abstract class FileUploadBase {
                 for (FileItem fileItem : items) {
                     try {
                         fileItem.delete();
-                    } catch (Throwable t) {
-                       handleThrowable(t);
+                    } catch (Exception ignored) {
+                        // ignored TODO perhaps add to tracker delete failure 
list somehow?
                     }
                 }
             }
@@ -375,25 +375,6 @@ public abstract class FileUploadBase {
     }
 
     /**
-     * Checks whether the supplied Throwable is one that needs to be
-     * rethrown and swallows all others.
-     * @param t the Throwable to check
-     */
-    private void handleThrowable(Throwable t) {
-        if (t instanceof ThreadDeath) {
-            throw (ThreadDeath) t;
-        }
-        if (t instanceof StackOverflowError) {
-            // Swallow silently - it should be recoverable
-            return;
-        }
-        if (t instanceof VirtualMachineError) {
-            throw (VirtualMachineError) t;
-        }
-        // All other instances of Throwable will be silently swallowed
-    }
-
-    /**
      * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt";>RFC 1867</a>
      * compliant <code>multipart/form-data</code> stream.
      *


Reply via email to