Github user srdo commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2755#discussion_r200803766
  
    --- Diff: 
external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/NamedTopicFilter.java
 ---
    @@ -54,8 +57,12 @@ public NamedTopicFilter(String... topics) {
         public List<TopicPartition> 
getFilteredTopicPartitions(KafkaConsumer<?, ?> consumer) {
             List<TopicPartition> allPartitions = new ArrayList<>();
             for (String topic : topics) {
    -            for (PartitionInfo partitionInfo: 
consumer.partitionsFor(topic)) {
    -                allPartitions.add(new 
TopicPartition(partitionInfo.topic(), partitionInfo.partition()));
    +            if(consumer.partitionsFor(topic) != null) {
    --- End diff --
    
    I think it would be better to put the result of partitionsFor in a 
variable, rather than asking for it twice


---

Reply via email to