chia7712 commented on code in PR #15458:
URL: https://github.com/apache/kafka/pull/15458#discussion_r1510162458
##########
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:
that makes sense to me. Could you change the type from `String` to
`Optional<String>` to handle the null?
--
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]