Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -262,7 +262,7 @@ private[spark] object Utils extends Logging {
if (dir.exists() || !dir.mkdirs()) {
dir = null
}
} catch { case e: IOException => ; }
} catch { case e: SecurityException => dir = null; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like these two methods can't throw IOException after all, is that the gist of it? mkdirs just returns false if it fails, hm. https://docs.oracle.com/javase/7/docs/api/java/io/File.html#mkdirs()

dir = null is a good bug fix. I might have changed this to not even assign dir and hold the new File in a temp variable until the checks succeeded. This looks equivalent though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The only exception they would throw is SecurityException. And when mkdirs finds failures other than SecurityException it just returns false.

}

registerShutdownDeleteDir(dir)
Expand Down