diff --git a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java index 28c3a68e70dde..e52bcfd1e3aee 100644 --- a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java +++ b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java @@ -222,6 +222,15 @@ public static void main(String[] args) throws Exception { arguments.authPluginClassName = arguments.deprecatedAuthPluginClassName; } + for (String arg : arguments.topic) { + if (arg.startsWith("-")) { + System.out.printf("invalid option: '%s'\nTo use a topic with the name '%s', " + + "please use a fully qualified topic name\n", arg, arg); + jc.usage(); + PerfClientUtils.exit(-1); + } + } + if (arguments.topic != null && arguments.topic.size() != arguments.numTopics) { // keep compatibility with the previous version if (arguments.topic.size() == 1) { diff --git a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java index 3ff78909a687f..6600e3083e0ea 100644 --- a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java +++ b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java @@ -292,6 +292,15 @@ public static void main(String[] args) throws Exception { arguments.authPluginClassName = arguments.deprecatedAuthPluginClassName; } + for (String arg : arguments.topics) { + if (arg.startsWith("-")) { + System.out.printf("invalid option: '%s'\nTo use a topic with the name '%s', " + + "please use a fully qualified topic name\n", arg, arg); + jc.usage(); + PerfClientUtils.exit(-1); + } + } + if (arguments.topics != null && arguments.topics.size() != arguments.numTopics) { // keep compatibility with the previous version if (arguments.topics.size() == 1) { diff --git a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceReader.java b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceReader.java index cc2d6315eeb1a..6adb0a9ca448e 100644 --- a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceReader.java +++ b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceReader.java @@ -122,6 +122,15 @@ public static void main(String[] args) throws Exception { PerfClientUtils.exit(-1); } + for (String arg : arguments.topic) { + if (arg.startsWith("-")) { + System.out.printf("invalid option: '%s'\nTo use a topic with the name '%s', " + + "please use a fully qualified topic name\n", arg, arg); + jc.usage(); + PerfClientUtils.exit(-1); + } + } + if (arguments.topic != null && arguments.topic.size() != arguments.numTopics) { // keep compatibility with the previous version if (arguments.topic.size() == 1) {