Repository: hbase Updated Branches: refs/heads/branch-1 927803710 -> cef9fffa3
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/cef9fffa Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/cef9fffa Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/cef9fffa Branch: refs/heads/branch-1 Commit: cef9fffa3906eb8b01f0f2d76a39d9832a3d6fe6 Parents: 9278037 Author: anoopsamjohn <[email protected]> Authored: Sun Jul 30 15:41:03 2017 +0530 Committer: anoopsamjohn <[email protected]> Committed: Sun Jul 30 15:41:03 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/cef9fffa/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(); - } - } } /**
