Hi,
Well, the chances of it being changed on this list are nil ;)  The
chances of it being changed by the JSR154 team are better: contact them
at http://www.jcp.org/en/jsr/detail?id=154.  If/when the Spec changes,
it will be reflected in our CVS repositories.

Yoav Shapira http://www.yoavshapira.com


>-----Original Message-----
>From: Steve Kirk [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, October 13, 2004 10:29 AM
>To: 'Tomcat Users List'
>Subject: ServletException not wrapping cause correctly
>
>
>The short version is:  ServletException does not appear to wrap causes
>properly - is this a bug, or a case of "works as designed", or am I
just
>using it wrong?
>
>Also, what are the chances of it being changed to fall into line with
how
>other Throwables work?
>
>More details (from a longer mail that I sent last week):
>
>> The problem is that when wrapping an Exception with
>> ServletException, it seems to not wrap the underlying cause
>> correctly, in
>> that it cannot be retrieved using Throwable's getCause() method
later.
>> Instead, the cause has to be retrieved using ServletException's own
>> getRootCause() method.  So in the case below, the output is
>> "null" then "java.lang.Exception: My error message":
>>
>> import javax.servlet.ServletException;
>>
>> public class ServletExceptionTest
>> {
>>      public static void main(String[] args)
>>      {
>>              Exception e = new Exception("My error message");
>>              ServletException se = new ServletException(e);
>>              System.out.println(se.getCause());
>>              System.out.println(se.getRootCause());
>>      }
>> }
>>
>> This means having to write specific code to handle
>> ServletExceptions, rather
>> than being able to treat all Throwables generically.  This seems to
go
>> against the benefits of inheritance...?  Perhaps
>> ServletException was not
>> retrofitted to the "cause" approach when this was introduced in
>> JDK 1.4?? Or is there something more to it than that, which I'm
missing?
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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

Reply via email to