Skip to content

Commit

Permalink
[SPARK-9780] [STREAMING] [KAFKA] prevent NPE if KafkaRDD instantiation …
Browse files Browse the repository at this point in the history
…fails

Author: cody koeninger <[email protected]>

Closes #8133 from koeninger/SPARK-9780 and squashes the following commits:

406259d [cody koeninger] [SPARK-9780][Streaming][Kafka] prevent NPE if KafkaRDD instantiation fails
  • Loading branch information
koeninger authored and tdas committed Aug 13, 2015
1 parent 660e6dc commit 8ce6096
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ class KafkaRDD[
.dropWhile(_.offset < requestOffset)
}

override def close(): Unit = consumer.close()
override def close(): Unit = {
if (consumer != null) {
consumer.close()
}
}

override def getNext(): R = {
if (iter == null || !iter.hasNext) {
Expand Down

0 comments on commit 8ce6096

Please sign in to comment.