DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39088>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39088





------- Additional Comments From [EMAIL PROTECTED]  2007-01-15 08:00 -------
Here is some code that works for both ServletException and 
JspException:

public static Throwable getRootCause(ServletException e) {
    Throwable rootCause = e.getRootCause();
    return processRootCause(e, rootCause);
}

private static Throwable processRootCause(Exception e, Throwable rootCause) {
    if (rootCause == null || rootCause == e) {
        return e;   //The root cause is a ServletException or JspException
    }

    if (rootCause instanceof ServletException) {
        rootCause = getRootCause((ServletException) rootCause);
    } else if (rootCause instanceof JspException) {
        JspException jspRootCause = (JspException)rootCause;
        Throwable deeperRootCause = jspRootCause.getRootCause();
        rootCause = processRootCause(jspRootCause, deeperRootCause);
    }
    return rootCause;   //The root cause is not a ServletException or 
JspException
}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

Reply via email to