You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by an...@apache.org on 2017/07/30 09:19:57 UTC

hbase git commit: HBASE-18473 VC.listLabels() erroneously closes any connection.

Repository: hbase
Updated Branches:
  refs/heads/master 2d06a06ba -> 5c47cb5d4


HBASE-18473 VC.listLabels() erroneously closes any connection.


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/5c47cb5d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5c47cb5d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5c47cb5d

Branch: refs/heads/master
Commit: 5c47cb5d491f78c00df0b09ed3899c9334c7fd85
Parents: 2d06a06
Author: anoopsamjohn <an...@gmail.com>
Authored: Sun Jul 30 14:49:38 2017 +0530
Committer: anoopsamjohn <an...@gmail.com>
Committed: Sun Jul 30 14:49:38 2017 +0530

----------------------------------------------------------------------
 .../hbase/security/visibility/VisibilityClient.java     | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/5c47cb5d/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java
index d99f454..dbcc13f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java
@@ -259,9 +259,7 @@ public class VisibilityClient {
    */
   public static ListLabelsResponse listLabels(Connection connection, final String regex)
       throws Throwable {
-    Table table = null;
-    try {
-      table = connection.getTable(LABELS_TABLE_NAME);
+    try (Table table = connection.getTable(LABELS_TABLE_NAME)) {
       Batch.Call<VisibilityLabelsService, ListLabelsResponse> callable =
           new Batch.Call<VisibilityLabelsService, ListLabelsResponse>() {
             ServerRpcController controller = new ServerRpcController();
@@ -289,14 +287,6 @@ public class VisibilityClient {
       return result.values().iterator().next(); // There will be exactly one region for labels
       // table and so one entry in result Map.
     }
-    finally {
-      if (table != null) {
-        table.close();
-      }
-      if (connection != null) {
-        connection.close();
-      }
-    }
   }
 
   /**