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=36231>.
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=36231





------- Additional Comments From [EMAIL PROTECTED]  2006-04-28 00:55 -------
If initCause() is called more than once, it throws IllegalStateException.  So,
anywhere already calling it on a ServletException would break.

The infinite loop risk could be avoided by not calling getRootCause():

public Throwable getCause() {
    return rootCause;
}

For consistency with initCause(), maybe it should only default to rootCause?  If
null causes are ignored, it could be done with just:

public Throwable getCause() {
    return super.getCause() == null ? rootCause : super.getCause();
}

But, to allow initCause(null) to have some effect, ServletException would need
to keep its own cause and override initCause() too.  The first would be the same
as in Throwable:

private Throwable cause = this;

public synchronized Throwable initCause(Throwable cause) {
    if (this.cause != this)
        throw new IllegalStateException("Can't overwrite cause");
    if (cause == this)
        throw new IllegalArgumentException("Self-causation not permitted");
    this.cause = cause;
    return this;
}

The last would default to rootCause instead of null:

public Throwable getCause() {
    return (cause == this ? rootCause : cause);
}

This seems pretty compatible to me, with both backwards and specs.  Can anyone
think of any problems?

I don't see anything resolving this in the Servlet 2.5 RM 5 spec.

-- 
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