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

CloseableThreadLocal should allow null Objects

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.1
    • Fix Version/s: 2.9
    • Component/s: modules/analysis
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      CloseableThreadLocal does not allow null Objects in its get() method, but does nothing to prevent them in set(Object). The comment in get() before assert v != null is irrelevant - the application might have passed null.

      Null is an important value for Analyzers. Since tokenStreams (a ThreadLocal private member in Analyzer) is not accessible by extending classes, the only way for an Analyzer to reset the tokenStreams is by calling setPreviousTokenStream(null).

      I will post a patch w/ a test

        Attachments

        1. LUCENE-1805.patch
          2 kB
          Michael McCandless
        2. LUCENE-1805.patch
          2 kB
          Shai Erera

          Activity

            People

            • Assignee:
              mikemccand Michael McCandless
              Reporter:
              shaie Shai Erera
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: