[
https://issues.apache.org/jira/browse/LUCENE-4671?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tim Smith updated LUCENE-4671:
------------------------------
Comment: was deleted
(was: looks like the index out of bounds check is a bit off too (if someone
ever uses non-zero offsets)
check should probably be:
{code}
if (start < offset || end > (offset + length) || start > end) {
throw new IndexOutOfBoundsException();
}
{code})
> CharsRef.subSequence broken
> ---------------------------
>
> Key: LUCENE-4671
> URL: https://issues.apache.org/jira/browse/LUCENE-4671
> Project: Lucene - Core
> Issue Type: Bug
> Reporter: Tim Smith
> Assignee: Robert Muir
> Attachments: LUCENE-4671.patch
>
>
> 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: [email protected]
For additional commands, e-mail: [email protected]