flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hshreedha...@apache.org
Subject flume git commit: FLUME-2773. TailDirSource throws FileNotFound Exception if ~/.flume directory is not created already
Date Fri, 25 Sep 2015 05:45:37 GMT
Repository: flume
Updated Branches:
  refs/heads/trunk 2cc93b777 -> 3fccd241d


FLUME-2773. TailDirSource throws FileNotFound Exception if ~/.flume directory is not created
already

(Johny Rufus via Hari)


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

Branch: refs/heads/trunk
Commit: 3fccd241d92bc5b70d216a2111e28897cf93c5df
Parents: 2cc93b7
Author: Hari Shreedharan <hshreedharan@apache.org>
Authored: Thu Sep 24 22:45:04 2015 -0700
Committer: Hari Shreedharan <hshreedharan@apache.org>
Committed: Thu Sep 24 22:45:04 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/flume/source/taildir/TaildirSource.java | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/3fccd241/flume-ng-sources/flume-taildir-source/src/main/java/org/apache/flume/source/taildir/TaildirSource.java
----------------------------------------------------------------------
diff --git a/flume-ng-sources/flume-taildir-source/src/main/java/org/apache/flume/source/taildir/TaildirSource.java
b/flume-ng-sources/flume-taildir-source/src/main/java/org/apache/flume/source/taildir/TaildirSource.java
index 97ca43b..8816327 100644
--- a/flume-ng-sources/flume-taildir-source/src/main/java/org/apache/flume/source/taildir/TaildirSource.java
+++ b/flume-ng-sources/flume-taildir-source/src/main/java/org/apache/flume/source/taildir/TaildirSource.java
@@ -22,6 +22,9 @@ import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstant
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -151,6 +154,12 @@ public class TaildirSource extends AbstractSource implements
 
     String homePath = System.getProperty("user.home").replace('\\', '/');
     positionFilePath = context.getString(POSITION_FILE, homePath + DEFAULT_POSITION_FILE);
+    Path positionFile = Paths.get(positionFilePath);
+    try {
+      Files.createDirectories(positionFile.getParent());
+    } catch (IOException e) {
+      throw new FlumeException("Error creating positionFile parent directories", e);
+    }
     headerTable = getTable(context, HEADERS_PREFIX);
     batchSize = context.getInteger(BATCH_SIZE, DEFAULT_BATCH_SIZE);
     skipToEnd = context.getBoolean(SKIP_TO_END, DEFAULT_SKIP_TO_END);


Mime
View raw message