You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2007/09/05 03:53:50 UTC

svn commit: r572854 - in /tomcat/container/tc5.5.x: catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java webapps/docs/changelog.xml

Author: markt
Date: Tue Sep  4 18:53:49 2007
New Revision: 572854

URL: http://svn.apache.org/viewvc?rev=572854&view=rev
Log:
An alternative fix for 30949 that does not require additional try/catch/finally blocks
Also remove unnecessary unwrapping now that unwrapRequest() and unwrapResponse() are called in invoke()

Modified:
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java?rev=572854&r1=572853&r2=572854&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java (original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java Tue Sep  4 18:53:49 2007
@@ -362,10 +362,6 @@
             wrequest.setQueryString(hrequest.getQueryString());
 
             processRequest(request,response,state);
-
-            wrequest.recycle();
-            unwrapRequest(state);
-
         }
 
         // Handle an HTTP path-based forward
@@ -401,10 +397,6 @@
             }
 
             processRequest(request,response,state);
-
-            wrequest.recycle();
-            unwrapRequest(state);
-
         }
 
         // This is not a real close in order to support error processing
@@ -554,8 +546,6 @@
                     ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
                     servletPath);
             invoke(state.outerRequest, state.outerResponse, state);
-
-            wrequest.recycle();
         }
 
         // Handle an HTTP path based include
@@ -592,8 +582,6 @@
                     ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
                     servletPath);
             invoke(state.outerRequest, state.outerResponse, state);
-
-            wrequest.recycle();
         }
 
     }
@@ -768,6 +756,8 @@
         // See Bugzilla 30949
         unwrapRequest(state);
         unwrapResponse(state);
+        // Recycle request if necessary (also BZ 30949)
+        recycleRequestWrapper(state);
 
         // Rethrow an exception if one was thrown by the invoked servlet
         if (ioException != null)
@@ -1024,6 +1014,12 @@
         if (!same) {
             throw new ServletException(sm.getString(
                     "applicationDispatcher.specViolation.response"));
+        }
+    }
+    
+    private void recycleRequestWrapper(State state) {
+        if (state.wrapRequest instanceof ApplicationHttpRequest) {
+            ((ApplicationHttpRequest) state.wrapRequest).recycle();
         }
     }
 }

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=572854&r1=572853&r2=572854&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Tue Sep  4 18:53:49 2007
@@ -34,6 +34,10 @@
   <subsection name="Catalina">
     <changelog>
       <fix>
+        <bug>30949</bug>: Improve previous fix. Ensure requests are re-cycled
+        on cross-context includes and forwards when an exception occurs in the
+        target page. (markt)
+      <fix>
         <bug>43216</bug>: Set correct StandardSession#accessCount as system property STRICT_SERVLET_COMPLIANCE is true after application restart with SESSION.ser file.
         Patch provided by Takayuki Kaneko (pero)
       </fix>



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