beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhalp...@apache.org
Subject [2/4] incubator-beam git commit: Add Additional Exists check to FileIOChannelFactory#create
Date Tue, 19 Jul 2016 00:07:59 GMT
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 <tgroh@google.com>
Authored: Mon Jul 18 14:41:21 2016 -0700
Committer: Dan Halperin <dhalperi@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(


Mime
View raw message