[ 
https://issues.apache.org/jira/browse/LUCENE-781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466852
 ] 

Doron Cohen commented on LUCENE-781:
------------------------------------

I thought it would not break MultiReader, just do unnecessary work for that 
method...?

Same new test (using that (readers[]) constructor) would fail also in previous 
versions. 

I think main difference is that for the MultiReader created inside IndexReader, 
(1) all readers share the same directory, and (2) it maintains a SegmentsInfos 
read from that single directory. 

Now this is not the case for the other (but still valid (?)) usage of 
MultiReader - because there is no single directory (well, not necessarily) and 
hence no SegmentInfos for the MultiReader. 

So it seems a possible fix would be:
- define a boolean e.g. isWholeIndex predicate in MultiReader 
- would be true when constructed with a non null dir and a non null 
segmentInfos 
- base operation upon it: 
- if isWholeIndex call super.isCurrent() otherwise do the (multi) logic in 
current fix.

> NPE in MultiReader.isCurrent() and getVersion()
> -----------------------------------------------
>
>                 Key: LUCENE-781
>                 URL: https://issues.apache.org/jira/browse/LUCENE-781
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>            Reporter: Daniel Naber
>         Attachments: multireader.diff, multireader_test.diff
>
>
> I'm attaching a fix for the NPE in MultiReader.isCurrent() plus a testcase. 
> For getVersion(), we should throw a better exception that NPE. I will commit 
> unless someone objects or has a better idea.

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to