Author: markt
Date: Tue Jun  7 13:00:50 2016
New Revision: 1747216

URL: http://svn.apache.org/viewvc?rev=1747216&view=rev
Log:
Follow-up to r1746735
r1746735 triggered the call to Processor.endRequest() in the correct location 
but failed to remove the call that was in the wrong location. This meant it 
could be called twice leading to request corruption.

Modified:
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1747216&r1=1747215&r2=1747216&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java 
Tue Jun  7 13:00:50 2016
@@ -104,29 +104,6 @@ public class AsyncContextImpl implements
 
     @Override
     public void fireOnComplete() {
-        // Fire the listeners
-        doFireOnComplete();
-
-        // The application doesn't know it has to stop read and/or writing 
until
-        // it receives the complete event so the request and response have to 
be
-        // closed after firing the event.
-        try {
-            // First of all ensure that any data written to the response is
-            // written to the I/O layer.
-            request.getResponse().finishResponse();
-            // Close the request and the response.
-            request.getCoyoteRequest().action(ActionCode.END_REQUEST, null);
-        } catch (Throwable t) {
-            ExceptionUtils.handleThrowable(t);
-            // Catch this here and allow async context complete to continue
-            // normally so a dispatch takes place which ensures that  the
-            // request and response objects are correctly recycled.
-            log.debug(sm.getString("asyncContextImpl.finishResponseError"), t);
-        }
-    }
-
-
-    private void doFireOnComplete() {
         List<AsyncListenerWrapper> listenersCopy =
                 new ArrayList<AsyncListenerWrapper>();
         listenersCopy.addAll(listeners);
@@ -425,9 +402,7 @@ public class AsyncContextImpl implements
             dispatch = null;
             runnable.run();
             if (!request.isAsync()) {
-                // Uses internal method since we don't want the 
request/response
-                // to be closed. That will be handled in the adapter.
-                doFireOnComplete();
+                fireOnComplete();
             }
         } catch (RuntimeException x) {
             // doInternalComplete(true);

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties?rev=1747216&r1=1747215&r2=1747216&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties 
Tue Jun  7 13:00:50 2016
@@ -81,7 +81,6 @@ aprListener.tooLateForSSLRandomSeed=Cann
 aprListener.tooLateForFIPSMode=Cannot setFIPSMode: SSL has already been 
initialized
 aprListener.initializedOpenSSL=OpenSSL successfully initialized ({0})
 
-asyncContextImpl.finishResponseError=Response did not finish cleanly after 
AsyncContext completed
 asyncContextImpl.request.ise=It is illegal to call getRequest() after 
complete() or any of the dispatch() methods has been called
 asyncContextImpl.requestEnded=The request associated with the AsyncContext has 
already completed processing.
 asyncContextImpl.response.ise=It is illegal to call getResponse() after 
complete() or any of the dispatch() methods has been called



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

Reply via email to