james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Burrell Donkin" <robertburrelldon...@gmail.com>
Subject Re: [JSieve] Sporadic Mysterious Exceptions
Date Thu, 09 Aug 2007 19:04:00 GMT
On 8/9/07, Stefano Bagnara <apache@bago.org> wrote:
> Bernd Fondermann ha scritto:
> > What types of exceptions do you get? NPE?
> >
> > if it wasn't for a ThreadLocal, I'd say that this method's init is not
> > atomic, if fieldInstance is NULL:
> >
> >    static protected void setInstance(CommandStateManager conditionManager)
> >     {
> >         if (null == fieldInstance)
> >             fieldInstance = new ThreadLocal();
> >         fieldInstance.set(conditionManager);
> >     }
> >
> > It leaves ThreadLocal uninitialized but accessible for a little
> > moment. if the method got interrupted in between and getInstance()
> > gets executed, this might result in a NPE.
>
> Good catch!!

+1

not sure that it's possible to create a good test for this but
https://issues.apache.org/jira/browse/JSIEVE-10 demonstrates that it
occurs in the wild. unless someone jumps in with a good idea for a
test, i'll commit a fix without a test.

- robert

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message