From: markt Date: Wed, 5 Sep 2007 02:01:02 +0000 (+0000) Subject: Port improved fix for bug 30949 to TC6. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=b87ab285ff7ed3acc5fb1e9e307938c5b7bcc188;p=tomcat7.0 Port improved fix for bug 30949 to TC6. git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@572856 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/core/ApplicationDispatcher.java b/java/org/apache/catalina/core/ApplicationDispatcher.java index 4053a4612..47ae0c707 100644 --- a/java/org/apache/catalina/core/ApplicationDispatcher.java +++ b/java/org/apache/catalina/core/ApplicationDispatcher.java @@ -341,10 +341,6 @@ final class ApplicationDispatcher wrequest.setQueryString(hrequest.getQueryString()); processRequest(request,response,state); - - wrequest.recycle(); - unwrapRequest(state); - } // Handle an HTTP path-based forward @@ -377,10 +373,6 @@ final class ApplicationDispatcher } processRequest(request,response,state); - - wrequest.recycle(); - unwrapRequest(state); - } // This is not a real close in order to support error processing @@ -521,8 +513,6 @@ final class ApplicationDispatcher ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR, servletPath); invoke(state.outerRequest, state.outerResponse, state); - - wrequest.recycle(); } // Handle an HTTP path based include @@ -555,8 +545,6 @@ final class ApplicationDispatcher ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR, servletPath); invoke(state.outerRequest, state.outerResponse, state); - - wrequest.recycle(); } } @@ -731,7 +719,9 @@ final class ApplicationDispatcher // 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; @@ -986,4 +976,9 @@ final class ApplicationDispatcher "applicationDispatcher.specViolation.response")); } } + + private void recycleRequestWrapper(State state) { + if (state.wrapRequest instanceof ApplicationHttpRequest) { + ((ApplicationHttpRequest) state.wrapRequest).recycle(); } + } } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index afd0854cc..e77fe4bba 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -35,6 +35,11 @@ + 30949: Improve previous fix. Ensure requests are re-cycled + on cross-context includes and forwards when an exception occurs in the + target page. (markt) + + 42944: Correctly handle servlet mappings that use a '+' character as part of the url pattern. (markt)