Repository: hbase Updated Branches: refs/heads/branch-1.3 f18f916f0 -> 3e450f7a0
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/3e450f7a Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/3e450f7a Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/3e450f7a Branch: refs/heads/branch-1.3 Commit: 3e450f7a077632902fafa43dc7d9afa462125060 Parents: f18f916 Author: anoopsamjohn <[email protected]> Authored: Sun Jul 30 15:43:41 2017 +0530 Committer: anoopsamjohn <[email protected]> Committed: Sun Jul 30 15:43:41 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/3e450f7a/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(); - } - } } /**
