Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-4671

CharsRef.subSequence broken

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.1, 3.6.3, 6.0
    • None
    • None
    • New

    Description

      Looks like CharsRef.subSequence() is currently broken

      It is implemented as:

        @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);
        }
      

      Since CharsRef constructor is (char[] chars, int offset, int length),
      Should Be:

        @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);
        }
      

      Attachments

        1. LUCENE-4671.patch
          2 kB
          Robert Muir

        Activity

          People

            rcmuir Robert Muir
            tsmith Tim Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: