Skip to content

Commit 891e37c

Browse files
committed
add error handling on mkdirs
1 parent c52010a commit 891e37c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/main/scala/org/apache/spark/deploy/SparkHadoopUtil.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,9 @@ object SparkHadoopUtil {
473473
val builderMethod = fs.getClass().getMethod("createFile", classOf[Path])
474474
// the builder api does not resolve relative paths, nor does it create parent dirs, while
475475
// the old api does.
476-
fs.mkdirs(path.getParent())
476+
if (!fs.mkdirs(path.getParent())) {
477+
throw new IOException(s"Failed to create parents of $path")
478+
}
477479
val qualifiedPath = fs.makeQualified(path)
478480
val builder = builderMethod.invoke(fs, qualifiedPath)
479481
val builderCls = builder.getClass()

0 commit comments

Comments
 (0)