lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <ser...@gmail.com>
Subject A report for "Not so important (but still is a) bug"
Date Sun, 08 Nov 2009 13:58:35 GMT
Hi

I wanted to check something and wrote this very simple program, which
surprisingly failed because of a FileNotFound exception:

      Directory dir = new RAMDirectory();
      IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(),
MaxFieldLength.UNLIMITED);
      writer.setInfoStream(System.out);
      writer.addDocument(new Document());
      writer.commit();
      writer.close();

It fails with the exception:

Exception in thread "main" java.io.FileNotFoundException: _0.prx
    at
org.apache.lucene.store.RAMDirectory.fileLength(RAMDirectory.java:149)
    at
org.apache.lucene.index.DocumentsWriter.segmentSize(DocumentsWriter.java:1150)
    at
org.apache.lucene.index.DocumentsWriter.flush(DocumentsWriter.java:587)
    at
org.apache.lucene.index.IndexWriter.doFlushInternal(IndexWriter.java:3572)
    at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:3483)
    at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:3474)
    at
org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1940)
    at
org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1894)

This happens on the latest code from trunk (and validated also against 2.4).
Seems like it's there forever. This only happens when I set infoStream,
because as part of the logging we compute the segment size. _0.prx is not
found because I didn't add any terms to the index. If I don't set the
infoStream, or add terms to the index, this exception is not thrown.

Like I wrote in the subject, I don't think it's that important (for example
to hold off 2.9.1), but still a bug. Not a very important bug even, but I
can't get it out of my head that it's still a bug :)

Can be fixed by making sure segmentSize() does not thrown any FNF exception
for missing .prx? Does not sound too safe to me. Maybe we just remember this
and tell people (like me) "even in silly tests, add a term to the document"?

Shai.

Mime
View raw message