You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/03/12 18:11:34 UTC

[GitHub] [beam] boyuanzz commented on a change in pull request #14217: [BEAM-8221] Fix NPE while reading from non-existent Kafka topic

boyuanzz commented on a change in pull request #14217:
URL: https://github.com/apache/beam/pull/14217#discussion_r593366010



##########
File path: sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaUnboundedSource.java
##########
@@ -66,7 +66,12 @@
     if (partitions.isEmpty()) {
       try (Consumer<?, ?> consumer = spec.getConsumerFactoryFn().apply(spec.getConsumerConfig())) {
         for (String topic : spec.getTopics()) {
-          for (PartitionInfo p : consumer.partitionsFor(topic)) {
+          List<PartitionInfo> partitionInfoList = consumer.partitionsFor(topic);

Review comment:
       I'm wondering whether it's possible that we get empty list here since KafkaConsumer javadoc doesn't state it explicitly.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org