FrankYang0529 commented on code in PR #15458:
URL: https://github.com/apache/kafka/pull/15458#discussion_r1510158945
##########
tools/src/main/java/org/apache/kafka/tools/TopicCommand.java:
##########
@@ -210,7 +210,7 @@ private static Integer
getReplicationFactor(TopicPartitionInfo tpi, PartitionRea
*/
private static void ensureTopicExists(List<String> foundTopics, String
requestedTopic, Boolean requireTopicExists) {
// If no topic name was mentioned, do not need to throw exception.
- if (!(requestedTopic.isEmpty() ||
!Optional.ofNullable(requestedTopic).isPresent()) && requireTopicExists &&
foundTopics.isEmpty()) {
+ if (requestedTopic != null && !requestedTopic.isEmpty() &&
requireTopicExists && foundTopics.isEmpty()) {
Review Comment:
Yeah, I know there is no null input case for `requestedTopic`. However, do
we want to check `requestedTopic != null` to prevent null case in the future?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]