commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1565332 - /commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/Streams.java
Date Thu, 06 Feb 2014 16:42:19 GMT
Author: ggregory
Date: Thu Feb  6 16:42:19 2014
New Revision: 1565332

URL: http://svn.apache.org/r1565332
Log:
Use IOUtils.closeQuietly() instead of custom code.

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

Modified: commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/Streams.java
URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/Streams.java?rev=1565332&r1=1565331&r2=1565332&view=diff
==============================================================================
--- commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/Streams.java
(original)
+++ commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/Streams.java
Thu Feb  6 16:42:19 2014
@@ -22,6 +22,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 
 import org.apache.commons.fileupload.InvalidFileNameException;
+import org.apache.commons.io.IOUtils;
 
 /**
  * Utility class for working with streams.
@@ -119,19 +120,9 @@ public final class Streams {
             in = null;
             return total;
         } finally {
-            if (in != null) {
-                try {
-                    in.close();
-                } catch (Throwable t) {
-                    /* Ignore me */
-                }
-            }
-            if (closeOutputStream  &&  out != null) {
-                try {
-                    out.close();
-                } catch (Throwable t) {
-                    /* Ignore me */
-                }
+            IOUtils.closeQuietly(in);
+            if (closeOutputStream) {
+                IOUtils.closeQuietly(out);
             }
         }
     }



Mime
View raw message