Author: markt
Date: Tue Sep  4 19:01:02 2007
New Revision: 572856

URL: http://svn.apache.org/viewvc?rev=572856&view=rev
Log:
Port improved fix for bug 30949 to TC6.

Modified:
    
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java?rev=572856&r1=572855&r2=572856&view=diff
==============================================================================
--- 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java 
(original)
+++ 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java 
Tue Sep  4 19:01:02 2007
@@ -341,10 +341,6 @@
             wrequest.setQueryString(hrequest.getQueryString());
 
             processRequest(request,response,state);
-
-            wrequest.recycle();
-            unwrapRequest(state);
-
         }
 
         // Handle an HTTP path-based forward
@@ -377,10 +373,6 @@
             }
 
             processRequest(request,response,state);
-
-            wrequest.recycle();
-            unwrapRequest(state);
-
         }
 
         // This is not a real close in order to support error processing
@@ -521,8 +513,6 @@
                     ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
                     servletPath);
             invoke(state.outerRequest, state.outerResponse, state);
-
-            wrequest.recycle();
         }
 
         // Handle an HTTP path based include
@@ -555,8 +545,6 @@
                     ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
                     servletPath);
             invoke(state.outerRequest, state.outerResponse, state);
-
-            wrequest.recycle();
         }
 
     }
@@ -731,7 +719,9 @@
         // 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)
             throw ioException;
@@ -985,5 +975,10 @@
             throw new ServletException(sm.getString(
                     "applicationDispatcher.specViolation.response"));
         }
+    }
+
+    private void recycleRequestWrapper(State state) {
+        if (state.wrapRequest instanceof ApplicationHttpRequest) {
+            ((ApplicationHttpRequest) state.wrapRequest).recycle();        }
     }
 }

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=572856&r1=572855&r2=572856&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Tue Sep  4 19:01:02 2007
@@ -35,6 +35,11 @@
   <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>
+      <fix>
         <bug>42944</bug>: Correctly handle servlet mappings that use a '+'
         character as part of the url pattern. (markt)
       </fix>



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

Reply via email to