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

BytesTermAttributeImpl.copyTo NPEs when the BytesRef is null

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.4.2, 5.5
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      The BytesTermAttributeImpl class, not used much I think, has a problem in its copyTo method in which it assumes "bytes" isn't null since it calls BytesRef.deepCopyOf on it. Perhaps deepCopyOf should support null? And also, toString(), equals() and hashCode() aren't implemented but we can do so.
      This was discovered in SOLR-8541; the spatial PrefixTreeStrategy uses this attribute and the CachingTokenFilter when used on the analysis chain will call clearAttributes() in it's end() method and then capture the state so it can be replayed later. BytesTermAttributeImpl.clear() nulls out the bytes reference.

        Attachments

        1. LUCENE_6976.patch
          5 kB
          David Smiley
        2. LUCENE_6976.patch
          6 kB
          David Smiley

          Issue Links

            Activity

              People

              • Assignee:
                dsmiley David Smiley
                Reporter:
                dsmiley David Smiley
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: