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

    https://github.com/apache/spark/pull/22337#discussion_r216120240
  
    --- Diff: 
external/kafka-0-10/src/test/scala/org/apache/spark/streaming/kafka010/KafkaRDDSuite.scala
 ---
    @@ -44,20 +44,25 @@ class KafkaRDDSuite extends SparkFunSuite with 
BeforeAndAfterAll {
       private var sc: SparkContext = _
     
       override def beforeAll {
    +    super.beforeAll()
         sc = new SparkContext(sparkConf)
         kafkaTestUtils = new KafkaTestUtils
         kafkaTestUtils.setup()
       }
     
       override def afterAll {
    -    if (sc != null) {
    -      sc.stop
    -      sc = null
    -    }
    -
    -    if (kafkaTestUtils != null) {
    -      kafkaTestUtils.teardown()
    -      kafkaTestUtils = null
    +    try {
    +      if (sc != null) {
    +        sc.stop
    +        sc = null
    +      }
    +
    +      if (kafkaTestUtils != null) {
    +        kafkaTestUtils.teardown()
    +        kafkaTestUtils = null
    +      }
    +    } finally {
    +      super.afterAll()
    --- End diff --
    
    `sc.stop` can throw an exception. Thus, I updated this using nested 
`try-finally`.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to