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

    https://github.com/apache/spark/pull/5407#discussion_r27953529
  
    --- Diff: 
streaming/src/main/scala/org/apache/spark/streaming/Checkpoint.scala ---
    @@ -255,19 +263,24 @@ object CheckpointReader extends Logging {
             // loader to find and load classes. This is a well know Java issue 
and has popped up
             // in other places (e.g., 
http://jira.codehaus.org/browse/GROOVY-1627)
             val zis = compressionCodec.compressedInputStream(fis)
    -        val ois = new ObjectInputStreamWithLoader(zis,
    -          Thread.currentThread().getContextClassLoader)
    -        val cp = ois.readObject.asInstanceOf[Checkpoint]
    -        ois.close()
    -        fs.close()
    -        cp.validate()
    +        ois = new ObjectInputStreamWithLoader(zis,
    +            Thread.currentThread().getContextClassLoader)
    +        cpOption = Some(ois.readObject.asInstanceOf[Checkpoint])
             logInfo("Checkpoint successfully loaded from file " + file)
    -        logInfo("Checkpoint was generated at time " + cp.checkpointTime)
    -        return Some(cp)
           } catch {
             case e: Exception =>
               logWarning("Error reading checkpoint from file " + file, e)
    +      } finally {
    +        if (ois != null) {
    +          ois.close()
    +        }
    +        fs.close()
    +      }
    +      cpOption.foreach { cp =>
    +        cp.validate()
    +        logInfo("Checkpoint was generated at time " + cp.checkpointTime)
           }
    +      return cpOption
    --- End diff --
    
    I think this changes the semantics. before, an exception should ultimately 
mean a `SparkException. Now, you return `None`. In fact isn't the final 
statement unreachable now since the `finally` block returns?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to