Repository: hbase
Updated Branches:
  refs/heads/branch-1.4 1ecaa1d2a -> f309ea4c5


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

Branch: refs/heads/branch-1.4
Commit: f309ea4c51007a19bad992b88abe5043a5114c36
Parents: 1ecaa1d
Author: anoopsamjohn <[email protected]>
Authored: Sun Jul 30 15:42:26 2017 +0530
Committer: anoopsamjohn <[email protected]>
Committed: Sun Jul 30 15:42:26 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/f309ea4c/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 f8c7b0a..fd1a9d5 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
@@ -261,9 +261,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();
@@ -291,14 +289,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