[Swift-commit] cog r3434

swift at ci.uchicago.edu swift at ci.uchicago.edu
Mon Jul 30 04:15:04 CDT 2012


------------------------------------------------------------------------
r3434 | hategan | 2012-07-30 04:10:50 -0500 (Mon, 30 Jul 2012) | 1 line

also create parent directories if the file is zero-sized
------------------------------------------------------------------------
Index: modules/provider-coaster/src/org/globus/cog/abstraction/impl/file/coaster/handlers/providers/LocalIOProvider.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/impl/file/coaster/handlers/providers/LocalIOProvider.java	(revision 3433)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/impl/file/coaster/handlers/providers/LocalIOProvider.java	(working copy)
@@ -80,17 +80,17 @@
 
         public void setLength(long len) throws IOException {
             this.len = len;
+            File p = f.getParentFile();
+            if (!p.exists()) {
+                if (!p.mkdirs()) {
+                    throw new IOException("Failed to create directory " + p.getAbsolutePath());
+                }
+            }
             if (len == 0) {
                 f.createNewFile();
                 cb.done(this);
             }
             else {
-                File p = f.getParentFile();
-                if (!p.exists()) {
-                    if (!p.mkdirs()) {
-                        throw new IOException("Failed to create directory " + p.getAbsolutePath());
-                    }
-                }
                 buf = Buffers.newWriteBuffer(Buffers.getBuffers(Direction.OUT), new FileOutputStream(f).getChannel(), this);
             }
         }



More information about the Swift-commit mailing list