Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-5945: don't hit NPE on trying to get root's fileName leading to strange test failure

Michael McCandless47e96510cc2c
diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecDocParser.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecDocParser.java
index 62ff966e7c8..163020ea4e6 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecDocParser.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecDocParser.java
@@ -59,7 +59,7 @@ public abstract class TrecDocParser {
*/
public static ParsePathType pathType(Path f) {
int pathLength = 0;
- while (f != null && ++pathLength < MAX_PATH_LENGTH) {
+ while (f != null && f.getFileName() != null && ++pathLength < MAX_PATH_LENGTH) {
ParsePathType ppt = pathName2Type.get(f.getFileName().toString().toUpperCase(Locale.ROOT));
if (ppt!=null) {
return ppt;