tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher K. St. John" <...@distributopia.com>
Subject [PATCH][4.0] remove spurious casts in ApplicationFilterChain
Date Fri, 28 Dec 2001 20:18:24 GMT

 The "fall off the end of the chain" code in
ApplicationFilterChain.internalDoFilter checks if the
passed in request and response are HttpServletRequest/
Response objects. Based on the test, it casts the 
objects and invokes servlet.service(). However, since
the servlet member has a static type of javax.servlet.Servlet,
the exact same method is called in both cases. The code
operates correctly (since the non-http version of the 
service() method eventually invokes the correct version
of service()), but the test and cast are redundant and
confusing. The following patch removes them:


Index: ApplicationFilterChain.java
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java,v
retrieving revision 1.11
diff -u -r1.11 ApplicationFilterChain.java
--- ApplicationFilterChain.java 2001/10/11 23:30:58     1.11
+++ ApplicationFilterChain.java 2001/12/28 19:06:24
@@ -242,13 +242,7 @@
         try {
             support.fireInstanceEvent(InstanceEvent.BEFORE_SERVICE_EVENT,
                                       servlet, request, response);
-            if ((request instanceof HttpServletRequest) &&
-                (response instanceof HttpServletResponse)) {
-                servlet.service((HttpServletRequest) request,
-                                (HttpServletResponse) response);
-            } else {
-                servlet.service(request, response);
-            }
+            servlet.service(request, response);
             support.fireInstanceEvent(InstanceEvent.AFTER_SERVICE_EVENT,
                                       servlet, request, response);
         } catch (IOException e) {




-- 
Christopher St. John cks@distributopia.com
DistribuTopia http://www.distributopia.com

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message