xkrogen commented on a change in pull request #33101: URL: https://github.com/apache/spark/pull/33101#discussion_r661591703
########## File path: core/src/main/scala/org/apache/spark/util/Utils.scala ########## @@ -310,15 +306,17 @@ private[spark] object Utils extends Logging { while (dir == null) { attempts += 1 if (attempts > maxAttempts) { - throw new IOException("Failed to create a temp directory (under " + root + ") after " + - maxAttempts + " attempts!") + throw new IOException(s"Failed to create a temp directory (under $root) after " + + s"$maxAttempts attempts!") } try { dir = new File(root, namePrefix + "-" + UUID.randomUUID.toString) - if (dir.exists() || !dir.mkdirs()) { - dir = null - } - } catch { case e: SecurityException => dir = null; } + // SPARK-35907 Instead of File#mkdirs, Files#createDirectories is expected. + Files.createDirectories(dir.toPath) + } catch { case e: Exception => Review comment: I would argue that `createDirectory(File)` above is the one doing it wrong and we should correct it there rather than copying it, but will refer to @dongjoon-hyun and @mridulm here. Btw, `FileAlreadyExistsException` is an `IOException`, so you can just do ``` case e @ (_ : IOException | _ : SecurityException) => ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org