tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bognár, Attila" <>
Subject ErrorReportValve casting bug?
Date Sun, 20 Apr 2003 16:43:03 GMT


in the source of ErrorReportValve:

     public void invoke(Request request, Response response,
                        ValveContext context)
         throws IOException, ServletException {

         // Perform the request
         context.invokeNext(request, response);

         ServletRequest sreq = (ServletRequest) request;
         Throwable throwable =
             (Throwable) sreq.getAttribute(Globals.EXCEPTION_ATTR);

         ServletResponse sresp = (ServletResponse) response;

how legal are the two castings? ((ServletRequest) request at line 174 and
(ServletResponse) response). I think not at all. There should be instead:
request.getRequest(), since it should not be expected that a Request is
also a ServletRequest.


ps: I am writing a custom valve, where I make a wrapper request which does
not implement ServletRequest (why should it?), so there is a
ClassCastException. If I don't wrap it, it's a CoyoteRequest which
implements the ServletRequest interface, too, so there is no casting

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message