incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [2/2] git commit: Fixed NPE.
Date Tue, 20 Aug 2013 14:41:52 GMT
Fixed NPE.


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

Branch: refs/heads/master
Commit: c7385fb29de3d0f553c458336b01c6709d80e605
Parents: 510de99
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Aug 20 10:41:35 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Aug 20 10:41:35 2013 -0400

----------------------------------------------------------------------
 .../org/apache/blur/analysis/HdfsFieldManager.java    | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c7385fb2/blur-query/src/main/java/org/apache/blur/analysis/HdfsFieldManager.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/HdfsFieldManager.java b/blur-query/src/main/java/org/apache/blur/analysis/HdfsFieldManager.java
index b56faa1..70f6c3c 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/HdfsFieldManager.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/HdfsFieldManager.java
@@ -38,6 +38,8 @@ import org.apache.lucene.analysis.Analyzer;
 
 public class HdfsFieldManager extends BaseFieldManager {
 
+  private static final List<String> EMPTY_LIST = new ArrayList<String>();
+
   public static abstract class Lock {
 
     public abstract void lock();
@@ -86,14 +88,20 @@ public class HdfsFieldManager extends BaseFieldManager {
     _configuration = configuration;
     _fileSystem = _storagePath.getFileSystem(_configuration);
   }
-  
+
   @Override
   protected List<String> getFieldNamesToLoad() throws IOException {
+    if (!_fileSystem.exists(_storagePath)) {
+      return EMPTY_LIST;
+    }
     FileStatus[] listStatus = _fileSystem.listStatus(_storagePath);
-    List<String> fieldNames = new ArrayList<String>();
+    if (listStatus == null) {
+      return EMPTY_LIST;
+    }
+    List<String> fieldNames = EMPTY_LIST;
     for (FileStatus fileStatus : listStatus) {
       if (!fileStatus.isDir()) {
-        fieldNames.add(fileStatus.getPath().getName());  
+        fieldNames.add(fileStatus.getPath().getName());
       }
     }
     return fieldNames;


Mime
View raw message