Jesse Long created WICKET-4574:
----------------------------------
Summary: ThreadContext does not properly remove the ThreadLocal
from the current thread
Key: WICKET-4574
URL: https://issues.apache.org/jira/browse/WICKET-4574
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 6.0.0-beta1
Reporter: Jesse Long
Actually, I only checked 6.0.0-beta2 and master, 6.0.0-beta2 is not in the drop
down.
ThreadLocal.get() returns the current value, if one is set. If not, it creates
a new value using the initialValue() method, AND (importantly) registers the
ThreadLocal in the Thread's Map of ThreadLocals.
In order for the get(false) method to work as expected, we must actually call
ThreadLocal.remove() after a ThreadLocal.get() that returned null.
Also, after the request was processed, we never properly remove the ThreadLocal
from the Thread, we were simply setting it to the previous value, which was
null most of the time. This is not enough. The ThreadLocal was still attached
to the Thread, just the value it was storing was null.
Here's hoping that Jira is working again and I can attach a patch.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira