From c0b5d3334ad18eb98c69695fb2256e784a121821 Mon Sep 17 00:00:00 2001 From: yx9o Date: Thu, 30 Jan 2025 19:07:45 +0800 Subject: [PATCH] MINOR: Improve error message for invalid topic in TopicCommand (#18714) Reviewers: Divij Vaidya --- tools/src/main/java/org/apache/kafka/tools/TopicCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/src/main/java/org/apache/kafka/tools/TopicCommand.java b/tools/src/main/java/org/apache/kafka/tools/TopicCommand.java index e5171057c6cc0..32272d4e92685 100644 --- a/tools/src/main/java/org/apache/kafka/tools/TopicCommand.java +++ b/tools/src/main/java/org/apache/kafka/tools/TopicCommand.java @@ -210,7 +210,7 @@ private static void ensureTopicExists(List foundTopics, Optional // If no topic name was mentioned, do not need to throw exception. if (requestedTopic.isPresent() && !requestedTopic.get().isEmpty() && requireTopicExists && foundTopics.isEmpty()) { // If given topic doesn't exist then throw exception - throw new IllegalArgumentException(String.format("Topic '%s' does not exist as expected", requestedTopic)); + throw new IllegalArgumentException(String.format("Topic '%s' does not exist as expected", requestedTopic.get())); } }