mridulm commented on a change in pull request #33101:
URL: https://github.com/apache/spark/pull/33101#discussion_r659556697



##########
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:
       This is a good idea @dongjoon-hyun - `Files.createDirectories` lists the 
exceptions which can be thrown, we can restrict to the subset which need to be 
caught if they are expected to be ignored.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to