We should fix this; I'll open an issue & dig. Somehow SegmentInfo.files() is being buggy, claiming _0.prx is a file belonging to the segment, when it clearly isn't.
BTW we can't hold 2.9.1, since it's now "out" (as of yesterday) :) Mike On Sun, Nov 8, 2009 at 8:58 AM, Shai Erera <ser...@gmail.com> wrote: > 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. > --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org For additional commands, e-mail: java-dev-h...@lucene.apache.org