fozzie15 commented on code in PR #34258: URL: https://github.com/apache/beam/pull/34258#discussion_r2004177790
########## sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/WatchForKafkaTopicPartitions.java: ########## @@ -189,14 +194,28 @@ static List<TopicPartition> getAllTopicPartitions( kafkaConsumerFactoryFn.apply(kafkaConsumerConfig)) { if (topics != null && !topics.isEmpty()) { for (String topic : topics) { - for (PartitionInfo partition : kafkaConsumer.partitionsFor(topic)) { + List<PartitionInfo> partitionInfoList = kafkaConsumer.partitionsFor(topic); + checkState( + partitionInfoList != null, + "Could not find any partitions info for topic " + + topic + + ". Please check Kafka configuration and make sure " + + "that provided topics exist."); + for (PartitionInfo partition : partitionInfoList) { Review Comment: I believe that this condition will hit as these topics are derived from a list of topics provided by a user. I wrote a test that demonstrates how we might encounter this scenario. If someone allows for auto topic creation, this will not fail. -- 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: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org