fozzie15 commented on code in PR #34258: URL: https://github.com/apache/beam/pull/34258#discussion_r2004176274
########## 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) { current.add(new TopicPartition(topic, partition.partition())); } } } else { for (Map.Entry<String, List<PartitionInfo>> topicInfo : kafkaConsumer.listTopics().entrySet()) { if (topicPattern == null || topicPattern.matcher(topicInfo.getKey()).matches()) { + List<PartitionInfo> partitionInfoList = topicInfo.getValue(); + if (partitionInfoList == null) { + LOG.warn( + "Could not find any partitions info for topic {}. Please check Kafka configuration and make sure " + + "that provided topics exist.", + topicInfo.getKey()); + } Review Comment: Removed, same as above. -- 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