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

    https://github.com/apache/spark/pull/5223#discussion_r27516114
  
    --- Diff: 
core/src/main/scala/org/apache/spark/deploy/rest/StandaloneRestClient.scala ---
    @@ -147,9 +148,15 @@ private[deploy] class StandaloneRestClient extends 
Logging {
         conn.setRequestProperty("Content-Type", "application/json")
         conn.setRequestProperty("charset", "utf-8")
         conn.setDoOutput(true)
    -    val out = new DataOutputStream(conn.getOutputStream)
    -    out.write(json.getBytes(Charsets.UTF_8))
    -    out.close()
    +    var out: DataOutputStream = null
    --- End diff --
    
    Let's see if there are other changes that are needed, but, I think this 
pattern is slightly inconsistent with the others. `out` can be a `val` that is 
declared before the try block. I suppose if the object to be closed never 
instantiates, there's nothing to call `close()` on anyway. If we were really 
picky we'd have to handle the case of `conn.getOutputStream` succeeding while 
the constructor fails but I think it is not needed here.


---
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