asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Till Westmann (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: ASTERIXDB-1356: report file not found
Date Sat, 02 Apr 2016 05:04:25 GMT
Till Westmann has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/771

Change subject: ASTERIXDB-1356: report file not found
......................................................................

ASTERIXDB-1356: report file not found

Change-Id: Ia12bf84adfd8442103567df42ac22e5750e1360f
---
M asterix-external-data/src/main/java/org/apache/asterix/external/util/FileSystemWatcher.java
M asterix-external-data/src/main/java/org/apache/asterix/external/util/LocalFileSystemUtils.java
2 files changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/71/771/1

diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/util/FileSystemWatcher.java
b/asterix-external-data/src/main/java/org/apache/asterix/external/util/FileSystemWatcher.java
index 4eec348..71d8a5d 100644
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/util/FileSystemWatcher.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/util/FileSystemWatcher.java
@@ -70,7 +70,9 @@
     public void init() throws HyracksDataException {
         try {
             dirs.clear();
-            LocalFileSystemUtils.traverse(files, path.toFile(), expression, dirs);
+            if (! LocalFileSystemUtils.traverse(files, path.toFile(), expression, dirs))
{
+                throw new HyracksDataException(path + ": file not found");
+            }
             it = files.iterator();
             if (isFeed) {
                 keys.clear();
@@ -87,6 +89,8 @@
                 }
                 resume();
             }
+        } catch (HyracksDataException e) {
+            throw e;
         } catch (IOException e) {
             throw new HyracksDataException(e);
         }
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/util/LocalFileSystemUtils.java
b/asterix-external-data/src/main/java/org/apache/asterix/external/util/LocalFileSystemUtils.java
index d6e9463..d6fea4e 100644
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/util/LocalFileSystemUtils.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/util/LocalFileSystemUtils.java
@@ -32,10 +32,10 @@
 public class LocalFileSystemUtils {
 
     //TODO: replace this method by FileUtils.iterateFilesAndDirs(.)
-    public static void traverse(final LinkedList<File> files, File root, final String
expression,
+    public static boolean traverse(final LinkedList<File> files, File root, final String
expression,
             final LinkedList<Path> dirs) throws IOException {
         if (!Files.exists(root.toPath())) {
-            return;
+            return false;
         }
         if (!Files.isDirectory(root.toPath())) {
             validateAndAdd(root.toPath(), expression, files);
@@ -65,6 +65,7 @@
                 return FileVisitResult.CONTINUE;
             }
         });
+        return ! files.isEmpty();
     }
 
     public static void validateAndAdd(Path path, String expression, LinkedList<File>
files) {

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/771
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia12bf84adfd8442103567df42ac22e5750e1360f
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Till Westmann <tillw@apache.org>

Mime
View raw message