tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Kirk" <tomcat-u...@web-startup.co.uk>
Subject RE: ServletException not wrapping cause correctly
Date Wed, 13 Oct 2004 14:53:49 GMT

Sorry Yoav, but I'm not clear on why JSR154 is the place - I'd be grateful
if you could explain a little more please :)  Are you saying that the
problem is that the spec is wrong, rather than that there is a bug in
implementing it?  Or maybe that the code for ServletException is written by
that team rather than the Tomcat team?

Also, I as looking for views from list members on whether this is actually a
bug or not ..... :)

> -----Original Message-----
> From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com] 
> Sent: Wednesday 13 October 2004 15:35
> To: Tomcat Users List
> Subject: RE: ServletException not wrapping cause correctly
> 
> 
> 
> 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:tomcat-user@web-startup.co.uk]
> >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: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 
> 
> 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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message