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

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

Tim Smith created LUCENE-4671:
---------------------------------

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