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


##########
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:
   Began seeing null pointer exception errors in older versions of kafka. I 
reintroduced the null check and older versions passed. I suspect that it 
changed to return an empty list instead of null in a newer version, and as such 
we will have to check for both to preserve backwards compatibility.



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

Reply via email to