lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Kohlschütter (JIRA) <j...@apache.org>
Subject [jira] Created: (LUCENE-1918) Adding empty ParallelReader indexes to an IndexWriter may cause ArrayIndexOutOfBoundsException or NoSuchElementException
Date Thu, 17 Sep 2009 21:23:57 GMT
Adding empty ParallelReader indexes to an IndexWriter may cause ArrayIndexOutOfBoundsException
or NoSuchElementException
------------------------------------------------------------------------------------------------------------------------

                 Key: LUCENE-1918
                 URL: https://issues.apache.org/jira/browse/LUCENE-1918
             Project: Lucene - Java
          Issue Type: Bug
          Components: Index
    Affects Versions: 2.4.1, 2.4.2, 2.9
         Environment: any
            Reporter: Christian Kohlschütter
             Fix For: 2.9, 2.4.1


Hi,
I recently stumbled upon this:

It is possible (and perfectly legal) to add empty indexes (IndexReaders) to an IndexWriter.
However, when using ParallelReaders in this context, in two situations RuntimeExceptions may
occur for no good reason.

Condition 1:
The indexes within the ParallelReader are just empty.

When adding them to the IndexWriter, we get a java.util.NoSuchElementException triggered by
ParallelTermEnum's constructor. The reason for that is the TreeMap#firstKey() method which
was assumed to return null if there is no entry (which is not true, apparently -- it only
returns null if the first key in the Map is null).


Condition 2 (Assuming the aforementioned bug is fixed):
The indexes within the ParallelReader originally contained one or more fields with TermVectors,
but all documents have been marked as deleted.

When adding the indexes to the IndexWriter, we get a java.lang.ArrayIndexOutOfBoundsException
triggered by TermVectorsWriter#addAllDocVectors. The reason here is that TermVectorsWriter
assumes that if the index is marked to have TermVectors, at least one field actually exists
for that. This unfortunately is not true, either.

Patches and a testcase demonstrating the two bugs are provided.

Cheers,
Christian

-- 
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


Mime
View raw message