Inconsistent comment and code for the method "document(int n, FieldSelector 
fieldSelector)" in the classes 
"org.apache.lucene.index.{IndexReader,FilterIndexReader,SegmentReader}".
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: LUCENE-3570
                 URL: https://issues.apache.org/jira/browse/LUCENE-3570
             Project: Lucene - Java
          Issue Type: Bug
          Components: core/index
    Affects Versions: 3.4, 3.3, 3.2, 3.1, 3.0.3, 3.0.2, 3.0.1, 3.0, 2.9.4, 2.9.3
         Environment: Platform Independent
            Reporter: SHIN HWEI TAN


The method "document" in the "SegmentReader" and "FilterIndexReader" classes 
does not check the "fieldSelector" parameter for "null", whereas the Javadoc 
comment in the abstract superclass "IndexReader" explicitly states the 
parameter "May be null":

  /**
   ...
   * @param fieldSelector The {@link FieldSelector} to use to determine what
   *        Fields should be loaded on the Document. May be null, in which case
   *        all Fields will be loaded.
   ...
   */
  public abstract Document document(int n, FieldSelector fieldSelector) throws 
CorruptIndexException, IOException;

Suggested Fixes:
1. Add code "if (fieldSelector == null) ..." at the beginning of the method 
body in "FilterIndexReader" and "SegmentReader".
OR
2. Remove the part "May be null, in which case all Fields will be loaded" from 
the comment in "IndexReader".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to