Skip to content

Commit

Permalink
add error handling on mkdirs
Browse files Browse the repository at this point in the history
  • Loading branch information
squito committed Dec 3, 2018
1 parent c52010a commit 891e37c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,9 @@ object SparkHadoopUtil {
val builderMethod = fs.getClass().getMethod("createFile", classOf[Path])
// the builder api does not resolve relative paths, nor does it create parent dirs, while
// the old api does.
fs.mkdirs(path.getParent())
if (!fs.mkdirs(path.getParent())) {
throw new IOException(s"Failed to create parents of $path")
}
val qualifiedPath = fs.makeQualified(path)
val builder = builderMethod.invoke(fs, qualifiedPath)
val builderCls = builder.getClass()
Expand Down

0 comments on commit 891e37c

Please sign in to comment.