Repository: hbase
Updated Branches:
  refs/heads/branch-2 12b9a151e -> d776a3caa


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/d776a3ca
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/d776a3ca
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/d776a3ca

Branch: refs/heads/branch-2
Commit: d776a3caae935f3e08d8a8a5d2ffdaf23cb9b41f
Parents: 12b9a15
Author: anoopsamjohn <[email protected]>
Authored: Sun Jul 30 15:38:18 2017 +0530
Committer: anoopsamjohn <[email protected]>
Committed: Sun Jul 30 15:38:18 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/d776a3ca/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();
-      }
-    }
   }
 
   /**

Reply via email to