-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-4597] Use proper exception and reset variable #3449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Jenkins, this is ok to test. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
Test build #23831 has finished for PR 3449 at commit
|
|
@JoshRosen @srowen Any other comments? Is this ok to be merged? |
|
LGTM, so I'm going to merge this into |
…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 <[email protected]> Closes #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 <[email protected]>
…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 <[email protected]> Closes #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 <[email protected]>
…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 <[email protected]> Closes #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 <[email protected]>
File.exists()andFile.mkdirs()only throwSecurityExceptioninstead ofIOException. Then, when an exception is thrown,dirshould be reset too.