This has been discussed a few times before.  For example,
http://article.gmane.org/gmane.comp.java.tapestry.user/31641/match=illegalstateexception

As you say, Tapestry doesn't allow the exception to bubble up to the
user, but it does put a worrisome stack trace in the log.  The Tapestry
developers weren't highly motivated to fix this minor annoyance :-)  so
I just ignored it for a while, and then worked around it in my custom
Engine. It's not pretty but hey, it's a work-around.


    private static final String CLIENT_ABORT_EXCEPTION_NAME =
            "org.apache.catalina.connector.ClientAbortException";
    private static final String ILLEGAL_STATE_EXCEPTION_NAME =
            "java.lang.IllegalStateException";
    private static final String SESSION_INVALIDATED =
            "Session already invalidated";
    private static final String UNABLE_TO_RESET =
            "Unable to reset response buffer";

    public void reportException(String reportTitle, Throwable cause)
    {
        ExceptionDescription ed = null;

        // Don't log ClientAbortExceptions at all.
        ExceptionDescription[] edArray = new
ExceptionAnalyzer().analyze(cause);
        assert edArray != null;
        if (edArray.length > 0) {
            ed = edArray[0];
        }

        if
(ed.getExceptionClassName().equals(CLIENT_ABORT_EXCEPTION_NAME)) {
            log.debug("Not logging ClientAbort exc'n");
            return;
        }

        // Avoid the ugly stack trace that Tapestry puts in the log for the
        // IllegalStateException when a user logs out.
        if (ed.getExceptionClassName().equals(ILLEGAL_STATE_EXCEPTION_NAME)
            && (ed.getMessage().indexOf(SESSION_INVALIDATED) != -1
                || ed.getMessage().indexOf(UNABLE_TO_RESET) != -1))
        {
            // This debug message doesn't show up for some reason.
            log.debug("Not logging session-already-invalidated exc'n");
            return;
        }

        log.error(reportTitle);
        //.... the rest mimics what Tapestry's reportException() does.




Christian Haselbach wrote:

>Hello,
>
>how can a session be invalidadted gracefully? Simply calling
>session.invalidate() (where session for example was retrieved using
>WebRequest.getSession()) does invalidate exception, but will result
>in an exception later on in AbstractEngine. Here, the state manager
>is flushed which will complain about the missing session.
>
>The exception is catched by AbstractEngine. But an error is logged.
>
>Any ideas? Thanks.
>
>Regards,
>Christian
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to