Repository: ignite
Updated Branches:
  refs/heads/ignite-1926 861134bd3 -> ba0088e3b


IGNITE-3649 IGFS: Local secondary: "create" flag is now used for append() 
operation. This closes #938.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ba0088e3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ba0088e3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ba0088e3

Branch: refs/heads/ignite-1926
Commit: ba0088e3b977ee006d7621dd4771719c027f1b8b
Parents: 861134b
Author: tledkov-gridgain <[email protected]>
Authored: Wed Aug 10 10:12:12 2016 +0300
Committer: vozerov-gridgain <[email protected]>
Committed: Wed Aug 10 10:12:12 2016 +0300

----------------------------------------------------------------------
 .../ignite/hadoop/fs/LocalIgfsSecondaryFileSystem.java | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ba0088e3/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/LocalIgfsSecondaryFileSystem.java
----------------------------------------------------------------------
diff --git 
a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/LocalIgfsSecondaryFileSystem.java
 
b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/LocalIgfsSecondaryFileSystem.java
index 537b2a4..bebaab4 100644
--- 
a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/LocalIgfsSecondaryFileSystem.java
+++ 
b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/LocalIgfsSecondaryFileSystem.java
@@ -411,16 +411,19 @@ public class LocalIgfsSecondaryFileSystem implements 
IgfsSecondaryFileSystem, Li
     @Override public OutputStream append(IgfsPath path, int bufSize, boolean 
create,
         @Nullable Map<String, String> props) {
         // TODO: IGNITE-3648.
-        // TODO: IGNITE-3649.
         try {
             File file = fileForPath(path);
 
             boolean exists = file.exists();
 
-            if (!exists)
-                throw new IOException("File not found.");
-
-            return new BufferedOutputStream(new FileOutputStream(file, true), 
bufSize);
+            if (exists)
+                return new BufferedOutputStream(new FileOutputStream(file, 
true), bufSize);
+            else {
+                if (create)
+                    return create0(path, false, bufSize);
+                else
+                    throw new IOException("File not found: " + path);
+            }
         }
         catch (IOException e) {
             throw handleSecondaryFsError(e, "Failed to append file [path=" + 
path + ']');

Reply via email to