Author: mattmann
Date: Sat Jun  8 00:06:23 2013
New Revision: 1490879

URL: http://svn.apache.org/r1490879
Log:
- fix for OODT-572 Replace mkdir with more multi-thread resilient forceMkdir in 
LocalDataTransferer contributed by Tom Barber

Modified:
    oodt/trunk/CHANGES.txt
    
oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java

Modified: oodt/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1490879&r1=1490878&r2=1490879&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Sat Jun  8 00:06:23 2013
@@ -4,6 +4,9 @@ Apache OODT Change Log
 Release 0.6 - Current Development
 --------------------------------------------
 
+* OODT-572 Replace mkdir with more multi-thread resilient forceMkdir in 
+  LocalDataTransferer (Tom Barber via mattmann)
+
 * OODT-559 Unit test failure in testDoDynamicReplacement for "Europe/London" 
   timezone (Tom Barber via mattmann)
 

Modified: 
oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java?rev=1490879&r1=1490878&r2=1490879&view=diff
==============================================================================
--- 
oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java
 (original)
+++ 
oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java
 Sat Jun  8 00:06:23 2013
@@ -277,19 +277,23 @@ public class LocalDataTransferer impleme
                && (fileRef.list() != null && fileRef.list().length == 0)) {
             // if it's a directory and it doesn't exist yet, we should
             // create it
-            // just in case there's no files in it
-            File dest = new File(directory, fileRef.getName());
-            if (!new File(new URI(dest.getAbsolutePath())).exists()) {
-               LOG.log(Level.FINER, "Directory: [" + dest.getAbsolutePath()
-                     + "] doesn't exist: creating it");
-               if (!new File(new URI(dest.getAbsolutePath())).mkdirs()) {
-                  LOG.log(
-                        Level.WARNING,
-                        "Unable to create directory: ["
-                              + dest.getAbsolutePath()
-                              + "] in local data transferer");
-               }
-            }
+             // just in case there's no files in it
+             File dest = new File(directory, fileRef.getName());
+             if (!new File(new URI(dest.getAbsolutePath())).exists()) {
+                 LOG.log(Level.FINER, "Directory: [" + dest.getAbsolutePath()
+                         + "] doesn't exist: creating it");
+                 try {
+                     FileUtils.forceMkdir(new File(new 
URI(dest.getAbsolutePath())));
+                 }
+                 catch(IOException e){
+                     LOG.log(
+                             Level.WARNING,
+                             "Unable to create directory: ["
+                                     + dest.getAbsolutePath()
+                                     + "] in local data transferer");
+
+                 }
+             }
          }
       }
    }
@@ -318,17 +322,20 @@ public class LocalDataTransferer impleme
             // if it's a directory and it doesn't exist yet, we should
             // create it
             // just in case there's no files in it
-            if (!new File(new URI(r.getDataStoreReference())).exists()) {
-               LOG.log(Level.FINER, "Directory: [" + r.getDataStoreReference()
-                     + "] doesn't exist: creating it");
-               if (!new File(new URI(r.getDataStoreReference())).mkdirs()) {
-                  LOG.log(
-                        Level.WARNING,
-                        "Unable to create directory: ["
-                              + r.getDataStoreReference()
-                              + "] in local data transferer");
-               }
-            }
+             if (!new File(new URI(r.getDataStoreReference())).exists()) {
+                 LOG.log(Level.FINER, "Directory: [" + 
r.getDataStoreReference()
+                         + "] doesn't exist: creating it");
+                 try {
+                     FileUtils.forceMkdir(new File(new 
URI(r.getDataStoreReference())));
+                 }
+                 catch(IOException e){
+                     LOG.log(
+                             Level.WARNING,
+                             "Unable to create directory: ["
+                                     + r.getDataStoreReference()
+                                     + "] in local data transferer");
+                 }
+             }
          }
       }
 


Reply via email to