lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Dlug (JIRA)" <>
Subject [jira] Created: (LUCENE-832) NPE when calling isCurrent() on a ParallellReader
Date Wed, 14 Mar 2007 15:06:09 GMT
NPE when calling isCurrent() on a ParallellReader

                 Key: LUCENE-832
             Project: Lucene - Java
          Issue Type: Bug
          Components: Index
    Affects Versions: 2.1, 2.0.0, 2.0.1, 2.2
            Reporter: Paul Dlug

As demonstrated by the test case below, if you call isCurrent() on a ParallelReader it causes
an NPE. Fix appears to be to add an isCurrent() to ParallelReader which calls it on the underlying
indexes but I'm not sure what other problems may be lurking here. Do methods such as getVersion(),
lastModified(), isOptimized() also have to be rewritten or is this a use case where ParallelReader
will never mimic IndexReader perfectly? At the very least this behavior should be documented
so others know what to expect.

    [junit] Testcase: testIsCurrent(org.apache.lucene.index.TestParallelReader):        Caused
    [junit] null
    [junit] java.lang.NullPointerException
    [junit]     at org.apache.lucene.index.SegmentInfos$
    [junit]     at org.apache.lucene.index.SegmentInfos.readCurrentVersion(
    [junit]     at org.apache.lucene.index.IndexReader.isCurrent(
    [junit]     at org.apache.lucene.index.TestParallelReader.testIsCurrent(

Index: src/test/org/apache/lucene/index/
--- src/test/org/apache/lucene/index/    (revision 518122)
+++ src/test/org/apache/lucene/index/    (working copy)
@@ -135,6 +135,15 @@
       assertEquals(docParallel.get("f4"), docSingle.get("f4"));
+  public void testIsCurrent() throws IOException {
+    Directory dir1 = getDir1();
+    Directory dir2 = getDir2();
+    ParallelReader pr = new ParallelReader();
+    pr.add(;
+    pr.add(;
+    assertTrue(pr.isCurrent());
+  }
   // Fiels 1-4 indexed together:
   private Searcher single() throws IOException {

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:
For additional commands, e-mail:

View raw message