From de233d4e370149e8a8135d6d426e374baafd957d Mon Sep 17 00:00:00 2001 From: Rajan Dhabalia Date: Mon, 7 Oct 2019 08:40:30 -0700 Subject: [PATCH] [pulsar-cli] fix ns-isolation-policy api output (#5313) --- .../java/org/apache/pulsar/admin/cli/CliCommand.java | 10 +--------- .../org/apache/pulsar/admin/cli/CmdFunctionWorker.java | 6 +++--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CliCommand.java b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CliCommand.java index 7a3d1507e824b..5fd97bb1d7ec5 100644 --- a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CliCommand.java +++ b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CliCommand.java @@ -171,15 +171,7 @@ static Set getAuthActions(List actions) { void print(List items) { for (T item : items) { - System.out.println(item); - } - } - - void printList(T item) { - try { - System.out.println(writer.writeValueAsString(item)); - } catch (Exception e) { - throw new RuntimeException(e); + print(item); } } diff --git a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctionWorker.java b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctionWorker.java index 6a166c7f894ca..847726a03b77f 100644 --- a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctionWorker.java +++ b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctionWorker.java @@ -50,7 +50,7 @@ class FunctionsStats extends BaseCommand { @Override void runCmd() throws Exception { - printList(admin.worker().getFunctionsStats()); + print(admin.worker().getFunctionsStats()); } } @@ -59,7 +59,7 @@ class CmdMonitoringMetrics extends BaseCommand { @Override void runCmd() throws Exception { - printList(admin.worker().getMetrics()); + print(admin.worker().getMetrics()); } } @@ -68,7 +68,7 @@ class GetCluster extends BaseCommand { @Override void runCmd() throws Exception { - printList(admin.worker().getCluster()); + print(admin.worker().getCluster()); } }