sjvanrossum commented on code in PR #34258:
URL: https://github.com/apache/beam/pull/34258#discussion_r2005915670


##########
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/WatchForKafkaTopicPartitions.java:
##########
@@ -189,7 +190,14 @@ 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 && !partitionInfoList.isEmpty(),

Review Comment:
   partitionInfoList will always be non-null here, see 
https://github.com/apache/kafka/blob/b83a23a4f90f757b3fcec05c93f27385daa49bcd/clients/src/main/java/org/apache/kafka/clients/consumer/internals/ClassicKafkaConsumer.java#L927



-- 
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]

Reply via email to