Skip to content

Commit

Permalink
[SPARK-4597] Use proper exception and reset variable in Utils.createT…
Browse files Browse the repository at this point in the history
…empDir()

`File.exists()` and `File.mkdirs()` only throw `SecurityException` instead of `IOException`. Then, when an exception is thrown, `dir` should be reset too.

Author: Liang-Chi Hsieh <viirya@gmail.com>

Closes apache#3449 from viirya/fix_createtempdir and squashes the following commits:

36cacbd [Liang-Chi Hsieh] Use proper exception and reset variable.

(cherry picked from commit 49fe879)
Signed-off-by: Josh Rosen <joshrosen@databricks.com>
  • Loading branch information
viirya authored and JoshRosen committed Nov 29, 2014
1 parent f8a4fd3 commit 24b5c03
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/scala/org/apache/spark/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ private[spark] object Utils extends Logging {
if (dir.exists() || !dir.mkdirs()) {
dir = null
}
} catch { case e: IOException => ; }
} catch { case e: SecurityException => dir = null; }
}

registerShutdownDeleteDir(dir)
Expand Down

0 comments on commit 24b5c03

Please sign in to comment.