You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by we...@apache.org on 2017/05/17 02:53:13 UTC

[35/50] [abbrv] hive git commit: HIVE-16645: Commands.java has missed the catch statement and has some code format errors (Saijin Huang, reviewed by Aihua Xu & Peter Vary)

HIVE-16645: Commands.java has missed the catch statement and has some code format errors (Saijin Huang, reviewed by Aihua Xu & Peter Vary)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/455ffdd9
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/455ffdd9
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/455ffdd9

Branch: refs/heads/hive-14535
Commit: 455ffdd9125bdfe73b2c7f7ddebaeff138b77f53
Parents: 77f44b6
Author: Aihua Xu <ai...@apache.org>
Authored: Mon May 15 11:09:08 2017 -0400
Committer: Aihua Xu <ai...@apache.org>
Committed: Mon May 15 11:36:07 2017 -0400

----------------------------------------------------------------------
 .../src/java/org/apache/hive/beeline/Commands.java  | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/455ffdd9/beeline/src/java/org/apache/hive/beeline/Commands.java
----------------------------------------------------------------------
diff --git a/beeline/src/java/org/apache/hive/beeline/Commands.java b/beeline/src/java/org/apache/hive/beeline/Commands.java
index da896a7..bcbc574 100644
--- a/beeline/src/java/org/apache/hive/beeline/Commands.java
+++ b/beeline/src/java/org/apache/hive/beeline/Commands.java
@@ -304,6 +304,7 @@ public class Commands {
         try {
           rs.close();
         } catch (Exception e) {
+          beeLine.error(e);
         }
       }
       // run as a batch
@@ -787,6 +788,7 @@ public class Commands {
   private BufferedRows getConfInternal(boolean call) {
     Statement stmnt = null;
     BufferedRows rows = null;
+    ResultSet rs = null;
     try {
       boolean hasResults = false;
       DatabaseConnection dbconn = beeLine.getDatabaseConnection();
@@ -803,19 +805,26 @@ public class Commands {
         }
       }
       if (hasResults) {
-        ResultSet rs = stmnt.getResultSet();
+        rs = stmnt.getResultSet();
         rows = new BufferedRows(beeLine, rs);
       }
     } catch (SQLException e) {
       beeLine.error(e);
     } finally {
-      if (stmnt != null) {
+      if (rs != null) {
         try {
-          stmnt.close();
+          rs.close();
         } catch (SQLException e1) {
           beeLine.error(e1);
         }
       }
+      if (stmnt != null) {
+        try {
+          stmnt.close();
+        } catch (SQLException e2) {
+          beeLine.error(e2);
+        }
+      }
     }
     return rows;
   }
@@ -1428,7 +1437,6 @@ public class Commands {
   public boolean closeall(String line) {
     if (close(null)) {
       while (close(null)) {
-        ;
       }
       return true;
     }