commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r374771 - /jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/util/FileHelper.java
Date Fri, 03 Feb 2006 22:51:34 GMT
Author: joerg
Date: Fri Feb  3 14:51:31 2006
New Revision: 374771

URL: http://svn.apache.org/viewcvs?rev=374771&view=rev
Log:
don't throw exception if directory already existed (in this case mkdirs() also returns false)

Modified:
    jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/util/FileHelper.java

Modified: jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/util/FileHelper.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/util/FileHelper.java?rev=374771&r1=374770&r2=374771&view=diff
==============================================================================
--- jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/util/FileHelper.java
(original)
+++ jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/util/FileHelper.java
Fri Feb  3 14:51:31 2006
@@ -187,8 +187,9 @@
         } else {
             if (!target.isDirectory()) {
                 if (!target.exists()) {
-                    if(!target.getParentFile().mkdirs()) {
-                        throw new IOException("Could not create target directory: " + target.getParentFile());
+                    File dir = target.getParentFile();
+                    if(!dir.exists() && !dir.mkdirs()) {
+                        throw new IOException("Could not create target directory: " + dir);
                     }
                     if (!target.createNewFile()) {
                         throw new IOException("Could not create target file: " + target);



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message