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:12:54 GMT
On 8/9/07, Stefano Bagnara <apache@bago.org> wrote:
> Stefano Bagnara ha scritto:
> > /**
> >  * Method execute executes a Block within the context of a new
> > ConditionManager.
> >  * @param mail
> >  * @param block
> >  * @return Object
> >  * @throws SieveException
> >  */
> > protected Object execute(MailAdapter mail, Block block) throws
> > SieveException {
> >   // Switch to a new ConditionManager
> >   ConditionManager oldManager = ConditionManager.getInstance();
> >   ConditionManager.resetInstance();
> >
> >   // Execute the Block
> >   Object result = block.execute(mail);
> >
> >   // Restore the old ConditionManager
> >   ConditionManager.setInstance(oldManager);
> >
> >   return result;
> > }

<snip>

> Furthermore, I see that this block is allowed to send SieveException.
> Maybe the setInstance(oldManager) should be called in a finally to make
> sure we place back the status to the right one (well, maybe after an
> exception the ConditionManager is ignored, but I think it is anyway
> better to cleanup).

http://svn.apache.org/repos/asf/james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractConditionalCommand.java

already has

    protected Object execute(MailAdapter mail, Block block) throws
SieveException
    {
        // Switch to a new ConditionManager
        ConditionManager oldManager = ConditionManager.getInstance();
        ConditionManager.resetInstance();

        try
        {
            // Execute the Block
            Object result = block.execute(mail);
            return result;
        }
        finally
        {
            // Always restore the old ConditionManager
            ConditionManager.setInstance(oldManager);
        }
    }

hope that this should cover it

- 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