hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1356108 - /hive/trunk/common/src/java/org/apache/hadoop/hive/common/FileUtils.java
Date Mon, 02 Jul 2012 08:36:07 GMT
Author: hashutosh
Date: Mon Jul  2 08:36:06 2012
New Revision: 1356108

URL: http://svn.apache.org/viewvc?rev=1356108&view=rev
Log:
HIVE-3207 : FileUtils.tar does not close input files (Navis Ryu via Ashutosh Chauhan)

Modified:
    hive/trunk/common/src/java/org/apache/hadoop/hive/common/FileUtils.java

Modified: hive/trunk/common/src/java/org/apache/hadoop/hive/common/FileUtils.java
URL: http://svn.apache.org/viewvc/hive/trunk/common/src/java/org/apache/hadoop/hive/common/FileUtils.java?rev=1356108&r1=1356107&r2=1356108&view=diff
==============================================================================
--- hive/trunk/common/src/java/org/apache/hadoop/hive/common/FileUtils.java (original)
+++ hive/trunk/common/src/java/org/apache/hadoop/hive/common/FileUtils.java Mon Jul  2 08:36:06
2012
@@ -267,7 +267,12 @@ public final class FileUtils {
         TarArchiveEntry tarEntry = new TarArchiveEntry(f, f.getName());
         tOut.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
         tOut.putArchiveEntry(tarEntry);
-        IOUtils.copy(new FileInputStream(f), tOut); // copy with 8K buffer, not close
+        FileInputStream input = new FileInputStream(f);
+        try {
+          IOUtils.copy(input, tOut); // copy with 8K buffer, not close
+        } finally {
+          input.close();
+        }
         tOut.closeArchiveEntry();
       }
       tOut.close(); // finishes inside



Mime
View raw message