You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Robert Muir (JIRA)" <ji...@apache.org> on 2013/01/09 19:42:12 UTC

[jira] [Commented] (LUCENE-4671) CharsRef.subSequence broken

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

Robert Muir commented on LUCENE-4671:
-------------------------------------

+1, this definitely looks wrong
                
> CharsRef.subSequence broken
> ---------------------------
>
>                 Key: LUCENE-4671
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4671
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Tim Smith
>
> Looks like CharsRef.subSequence() is currently broken
> It is implemented as:
> {code}
>   @Override
>   public CharSequence subSequence(int start, int end) {
>     // NOTE: must do a real check here to meet the specs of CharSequence
>     if (start < 0 || end > length || start > end) {
>       throw new IndexOutOfBoundsException();
>     }
>     return new CharsRef(chars, offset + start, offset + end);
>   }
> {code}
> Since CharsRef constructor is (char[] chars, int offset, int length),
> Should Be:
> {code}
>   @Override
>   public CharSequence subSequence(int start, int end) {
>     // NOTE: must do a real check here to meet the specs of CharSequence
>     if (start < 0 || end > length || start > end) {
>       throw new IndexOutOfBoundsException();
>     }
>     return new CharsRef(chars, offset + start, end - start);
>   }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
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