You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael McCandless (JIRA)" <ji...@apache.org> on 2007/03/22 21:33:32 UTC

[jira] Resolved: (LUCENE-844) org.apache.lucene.index.SegmentInfos.FindSegmentsFile.run() throwing NullPointerException

     [ https://issues.apache.org/jira/browse/LUCENE-844?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-844.
---------------------------------------

    Resolution: Duplicate

Thanks for opening this issue!

This is actually fixed already on the trunk (not yet released) under LUCENE-825.



> org.apache.lucene.index.SegmentInfos.FindSegmentsFile.run() throwing NullPointerException
> -----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-844
>                 URL: https://issues.apache.org/jira/browse/LUCENE-844
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 2.1
>            Reporter: Jean-Philippe Robichaud
>
> When writing a WeakReference based cache for storing IndexReader objects, I was hit by a NullPointerException thrown from nowhere
> The actual stacktrace I got is:
> java.lang.NullPointerException
>         at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:482)
>         at org.apache.lucene.index.IndexReader.open(IndexReader.java:147)
>         at org.apache.lucene.index.IndexReader.open(IndexReader.java:142)
> <...>
> The culprit  code is in org.apache.lucene.index.SegmentInfos.FindSegmentsFile :
> [line 471] 
>   if (0 == method) {
>           if (directory != null) {
>             files = directory.list();
>           } else {
>             files = fileDirectory.list();
>           }
>           gen = getCurrentSegmentGeneration(files);
>           if (gen == -1) {
>             String s = "";
>             for(int i=0;i<files.length;i++) { << EXCEPTION THROWN FROM HERE [line 482]
>               s += " " + files[i];
>             }
>             throw new FileNotFoundException("no segments* file found: files:" + s);
>           }
>         }
> A check on the "files" object is required as the fileDirectory.list() can return null.
> In my case, the problem came from the fact that I had no more FileDescriptor available (bug somewhere else in my code) but the NPE was the only info I got...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org