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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to