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

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1625792 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-09-17 19:59:03 +00:00
parent d1ea8d1d92
commit 47e96510cc
1 changed files with 1 additions and 1 deletions

View File

@ -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;