Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 12334 invoked from network); 31 Jul 2007 23:39:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Jul 2007 23:39:17 -0000 Received: (qmail 12764 invoked by uid 500); 31 Jul 2007 23:39:14 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 12732 invoked by uid 500); 31 Jul 2007 23:39:14 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 12709 invoked by uid 99); 31 Jul 2007 23:39:14 -0000 Received: from Unknown (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jul 2007 16:39:14 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jul 2007 23:39:13 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 14B3471417D for ; Tue, 31 Jul 2007 16:38:53 -0700 (PDT) Message-ID: <2879672.1185925133081.JavaMail.jira@brutus> Date: Tue, 31 Jul 2007 16:38:53 -0700 (PDT) From: "Michael Busch (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Updated: (LUCENE-832) NPE when calling isCurrent() on a ParallellReader In-Reply-To: <13279541.1173884769241.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael Busch updated LUCENE-832: --------------------------------- Attachment: lucene-832.patch This patch fixes ParallelReader similar to LUCENE-781: * ParallelReader.getVersion() now throws an UnsupportedOperationException. * ParallelReader.isOptimized() now checks if all underlying indexes are optimized and returns true in such a case. * ParallelReader.isCurrent() now checks if all underlying IndexReaders are up to date and returns true in such a case. * Additional tests in TestParallelReader to test these methods. All tests pass. I'm planning to commit this soon... > NPE when calling isCurrent() on a ParallellReader > ------------------------------------------------- > > Key: LUCENE-832 > URL: https://issues.apache.org/jira/browse/LUCENE-832 > Project: Lucene - Java > Issue Type: Bug > Components: Index > Affects Versions: 2.0.0, 2.0.1, 2.1, 2.2 > Reporter: Paul Dlug > Assignee: Michael Busch > Attachments: lucene-832.patch > > > 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 an ERROR > [junit] null > [junit] java.lang.NullPointerException > [junit] at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:502) > [junit] at org.apache.lucene.index.SegmentInfos.readCurrentVersion(SegmentInfos.java:336) > [junit] at org.apache.lucene.index.IndexReader.isCurrent(IndexReader.java:316) > [junit] at org.apache.lucene.index.TestParallelReader.testIsCurrent(TestParallelReader.java:146) > Index: src/test/org/apache/lucene/index/TestParallelReader.java > =================================================================== > --- src/test/org/apache/lucene/index/TestParallelReader.java (revision 518122) > +++ src/test/org/apache/lucene/index/TestParallelReader.java (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(IndexReader.open(dir1)); > + pr.add(IndexReader.open(dir2)); > + 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: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org