You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2014/06/06 18:21:58 UTC

svn commit: r1600954 - /hive/trunk/beeline/src/java/org/apache/hive/beeline/Commands.java

Author: hashutosh
Date: Fri Jun  6 16:21:58 2014
New Revision: 1600954

URL: http://svn.apache.org/r1600954
Log:
HIVE-7176 : FileInputStream is not closed in Commands#properties() (Navis via Ashutosh Chauhan)

Modified:
    hive/trunk/beeline/src/java/org/apache/hive/beeline/Commands.java

Modified: hive/trunk/beeline/src/java/org/apache/hive/beeline/Commands.java
URL: http://svn.apache.org/viewvc/hive/trunk/beeline/src/java/org/apache/hive/beeline/Commands.java?rev=1600954&r1=1600953&r2=1600954&view=diff
==============================================================================
--- hive/trunk/beeline/src/java/org/apache/hive/beeline/Commands.java (original)
+++ hive/trunk/beeline/src/java/org/apache/hive/beeline/Commands.java Fri Jun  6 16:21:58 2014
@@ -22,6 +22,8 @@
  */
 package org.apache.hive.beeline;
 
+import org.apache.hadoop.io.IOUtils;
+
 import java.io.BufferedReader;
 import java.io.FileInputStream;
 import java.io.FileReader;
@@ -831,7 +833,12 @@ public class Commands {
 
     for (int i = 1; i < parts.length; i++) {
       Properties props = new Properties();
-      props.load(new FileInputStream(parts[i]));
+      InputStream stream = new FileInputStream(parts[i]);
+      try {
+        props.load(stream);
+      } finally {
+        IOUtils.closeStream(stream);
+      }
       if (connect(props)) {
         successes++;
       }