GitHub user onurkaraman opened a pull request: https://github.com/apache/kafka/pull/1326
KAFKA-3661: fix NPE in o.a.k.c.c.RoundRobinAssignor when topic metadata not found AbstractPartitionAssignor.assign has an ambiguous line in its documentation: > @param partitionsPerTopic The number of partitions for each subscribed topic (may be empty for some topics) Does empty mean the topic has an entry with value zero, or that the entry is excluded from the map altogether? The current implementation in AbstractPartitionAssignor excludes the entry from partitionsPerTopic if the topic isn't in the metadata. RoundRobinAssignorTest.testOneConsumerNonexistentTopic interprets emptiness as providing the topic with a zero value. RangeAssignor interprets emptiness as excluding the entry from the map. RangeAssignorTest.testOneConsumerNonexistentTopic interprets emptiness as providing the topic with a zero value. This implementation chooses to solve the NPE by deciding to exclude topics from partitionsPerTopic when the topic is not in the metadata. You can merge this pull request into a Git repository by running: $ git pull https://github.com/onurkaraman/kafka KAFKA-3661 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/1326.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1326 ---- commit a1374bdd07d76044b196cf833e4efbb88c940d70 Author: Onur Karaman <okara...@linkedin.com> Date: 2016-05-05T18:07:00Z fix NPE in org.apache.kafka.clients.consumer.RoundRobinAssignor when topic metadata not found AbstractPartitionAssignor.assign has an ambiguous line in its documentation: @param partitionsPerTopic The number of partitions for each subscribed topic (may be empty for some topics) Does empty mean the topic has an entry with value zero, or that the entry is excluded from the map altogether? The current implementation in AbstractPartitionAssignor excludes the entry from partitionsPerTopic if the topic isn't in the metadata. RoundRobinAssignorTest.testOneConsumerNonexistentTopic interprets emptiness as providing the topic with a zero value. RangeAssignor interprets emptiness as excluding the entry from the map. RangeAssignorTest.testOneConsumerNonexistentTopic interprets emptiness as providing the topic with a zero value. This implementation chooses to solve the NPE by deciding to exclude topics from partitionsPerTopic when the topic is not in the metadata. ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---