You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by dh...@apache.org on 2016/07/19 00:07:59 UTC

[2/4] incubator-beam git commit: Add Additional Exists check to FileIOChannelFactory#create

Add Additional Exists check to FileIOChannelFactory#create

This ensures that if the folder did not exist when first checked, but
did by the time mkdirs was executed (and thus mkdirs returned false) the
create will not fail.


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/674d831d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/674d831d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/674d831d

Branch: refs/heads/master
Commit: 674d831dd61e9440f645eb91e920c0168d368ade
Parents: 62841ac
Author: Thomas Groh <tg...@google.com>
Authored: Mon Jul 18 14:41:21 2016 -0700
Committer: Dan Halperin <dh...@google.com>
Committed: Mon Jul 18 17:07:41 2016 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/beam/sdk/util/FileIOChannelFactory.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/674d831d/sdks/java/core/src/main/java/org/apache/beam/sdk/util/FileIOChannelFactory.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/FileIOChannelFactory.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/FileIOChannelFactory.java
index 7bc09e9..5033dca 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/FileIOChannelFactory.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/FileIOChannelFactory.java
@@ -108,7 +108,8 @@ public class FileIOChannelFactory implements IOChannelFactory {
     File file = new File(spec);
     if (file.getAbsoluteFile().getParentFile() != null
         && !file.getAbsoluteFile().getParentFile().exists()
-        && !file.getAbsoluteFile().getParentFile().mkdirs()) {
+        && !file.getAbsoluteFile().getParentFile().mkdirs()
+        && !file.getAbsoluteFile().getParentFile().exists()) {
       throw new IOException("Unable to create parent directories for '" + spec + "'");
     }
     return Channels.newChannel(