chia7712 commented on code in PR #15458:
URL: https://github.com/apache/kafka/pull/15458#discussion_r1510157302
##########
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:
it never pass null `requestedTopic`, and it results in
`!Optional.ofNullable(requestedTopic).isPresent()` being unnecessary condition
- it is always `false`
--
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]