lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (JIRA)" <>
Subject [jira] Updated: (LUCENE-1805) CloseableThreadLocal should allow null Objects
Date Thu, 13 Aug 2009 13:26:14 GMT


Shai Erera updated LUCENE-1805:

    Attachment: LUCENE-1805.patch

Remove assert v != null and added a test case.

Funny, but it's as if CTL itself could cause this bug. If you call ctl.get() w/o setting anything
first, it creates a WeakReference and set the initValue(), which is ... null !. The first
call to get() will return null, the second would fail. :)

BTW, TestCloseableThreadLocal is under o.a.l.index. Shouldn't it be under o.a.l.util? Can
whoever assigns this to himself move it?

> CloseableThreadLocal should allow null Objects
> ----------------------------------------------
>                 Key: LUCENE-1805
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: contrib/analyzers
>    Affects Versions: 2.4.1
>            Reporter: Shai Erera
>             Fix For: 2.9
>         Attachments: LUCENE-1805.patch
> 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

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message