runom commented on code in PR #14661:
URL: https://github.com/apache/kafka/pull/14661#discussion_r1375385416


##########
tools/src/main/java/org/apache/kafka/tools/TopicCommand.java:
##########
@@ -469,7 +469,7 @@ public void createTopic(CommandTopicPartition topic) throws 
Exception {
                 CreateTopicsResult createResult = 
adminClient.createTopics(Collections.singleton(newTopic),
                     new CreateTopicsOptions().retryOnQuotaViolation(false));
                 createResult.all().get();
-                System.out.println("Created topic " + topic.name + ".");
+                System.out.println("Created topic " + topic.name.get() + ".");

Review Comment:
   Thanks for reviewing! 
   
   Instead of adding topicName argument to `createTopic`, could we change the 
type of `CommandTopicPartition.name` from `Optional<String>` to `String`?
   `CommandTopicPartition` class is used in `createTopic` and `alterTopic`, and 
these operations require `--topic` option. Therefore, it does not seem 
necessary to be `Optional`.
   
   Or, since we already have the topic name,  we could simply define a local 
variable `String topicName = topic.name.get()` in `createTopic` to avoid 
calling `.get` method multiple times.
   
   What do you think about this?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to