commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r919263 - /commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
Date Fri, 05 Mar 2010 01:27:09 GMT
Author: sebb
Date: Fri Mar  5 01:27:08 2010
New Revision: 919263

URL: http://svn.apache.org/viewvc?rev=919263&view=rev
Log:
IO-207 Race condition in forceMkdir

Modified:
    commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?rev=919263&r1=919262&r2=919263&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java Fri Mar  5 01:27:08
2010
@@ -1539,9 +1539,14 @@
             }
         } else {
             if (!directory.mkdirs()) {
-                String message =
-                    "Unable to create directory " + directory;
-                throw new IOException(message);
+                // Double-check that some other thread or process hasn't made
+                // the directory in the background
+                if (!directory.isDirectory())
+                {
+                    String message =
+                        "Unable to create directory " + directory;
+                    throw new IOException(message);
+                }
             }
         }
     }



Mime
View raw message