allow blur to start if no commands file found

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

Branch: refs/heads/master
Commit: a2a204e94cc30a815338aaa4f6788295a1ce92a4
Parents: 67b689a
Author: Andrew Avenoso <[email protected]>
Authored: Wed Oct 29 00:07:01 2014 -0400
Committer: Andrew Avenoso <[email protected]>
Committed: Tue Nov 4 20:55:46 2014 -0500

----------------------------------------------------------------------
 .../apache/blur/command/BaseCommandManager.java | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/a2a204e9/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
----------------------------------------------------------------------
diff --git 
a/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java 
b/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
index 6ccded6..452a04d 100644
--- a/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
+++ b/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
@@ -186,16 +186,18 @@ public abstract class BaseCommandManager implements 
Closeable {
   protected synchronized int loadNewCommandsFromCommandPath() throws 
IOException {
     Path path = new Path(_commandPath);
     FileSystem fileSystem = path.getFileSystem(_configuration);
-    FileStatus[] listStatus = fileSystem.listStatus(path);
     int changeCount = 0;
-    for (FileStatus fileStatus : listStatus) {
-      BigInteger contentsCheck = checkContents(fileStatus, fileSystem);
-      Path entryPath = fileStatus.getPath();
-      BigInteger currentValue = _commandPathLastChange.get(entryPath);
-      if (!contentsCheck.equals(currentValue)) {
-        changeCount++;
-        loadNewCommand(fileSystem, fileStatus, contentsCheck);
-        _commandPathLastChange.put(entryPath, contentsCheck);
+    if(fileSystem.exists(path)) {
+      FileStatus[] listStatus = fileSystem.listStatus(path);
+      for (FileStatus fileStatus : listStatus) {
+        BigInteger contentsCheck = checkContents(fileStatus, fileSystem);
+        Path entryPath = fileStatus.getPath();
+        BigInteger currentValue = _commandPathLastChange.get(entryPath);
+        if (!contentsCheck.equals(currentValue)) {
+          changeCount++;
+          loadNewCommand(fileSystem, fileStatus, contentsCheck);
+          _commandPathLastChange.put(entryPath, contentsCheck);
+        }
       }
     }
     return changeCount;

Reply via email to