You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "SHIN HWEI TAN (Created) (JIRA)" <ji...@apache.org> on 2011/11/11 08:48:51 UTC

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

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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


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

Posted by "Simon Willnauer (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simon Willnauer reassigned LUCENE-3570:
---------------------------------------

    Assignee: Simon Willnauer
    
> 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: 2.9.3, 2.9.4, 3.0, 3.0.1, 3.0.2, 3.0.3, 3.1, 3.2, 3.3, 3.4
>         Environment: Platform Independent
>            Reporter: SHIN HWEI TAN
>            Assignee: Simon Willnauer
>   Original Estimate: 5m
>  Remaining Estimate: 5m
>
> 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


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

Posted by "Simon Willnauer (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simon Willnauer resolved LUCENE-3570.
-------------------------------------

    Resolution: Invalid

this isn't an issue since we check for null further downstream and don't access the FieldSelector anywhere in those IndexReader subclasses. The comment is correct as it is, we explicitly allow null values to indicate to load all fields. 

thanks for reporting this shin hwei tan, much appreciated!
                
> 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: 2.9.3, 2.9.4, 3.0, 3.0.1, 3.0.2, 3.0.3, 3.1, 3.2, 3.3, 3.4
>         Environment: Platform Independent
>            Reporter: SHIN HWEI TAN
>            Assignee: Simon Willnauer
>   Original Estimate: 5m
>  Remaining Estimate: 5m
>
> 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org