Ensure an access log entry is made if an error occurs during asynchronous request...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 29 Jun 2011 12:12:48 +0000 (12:12 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 29 Jun 2011 12:12:48 +0000 (12:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1141066 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/coyote/ajp/AbstractAjpProcessor.java
java/org/apache/coyote/http11/Http11AprProcessor.java
java/org/apache/coyote/http11/Http11NioProcessor.java
java/org/apache/coyote/http11/Http11Processor.java
webapps/docs/changelog.xml

index eacfc4d..0202290 100644 (file)
@@ -465,10 +465,13 @@ public abstract class AbstractAjpProcessor extends AbstractProcessor {
        } catch (Throwable t) {
            ExceptionUtils.handleThrowable(t);
            getLog().error(sm.getString("http11processor.request.process"), t);
-           // 500 - Internal Server Error
-           response.setStatus(500);
-           adapter.log(request, response, 0);
            error = true;
+       } finally {
+           if (error) {
+               // 500 - Internal Server Error
+               response.setStatus(500);
+               adapter.log(request, response, 0);
+           }
        }
 
        rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
index 12b1551..0d4cb6b 100644 (file)
@@ -355,10 +355,13 @@ public class Http11AprProcessor extends AbstractHttp11Processor {
         } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);
             log.error(sm.getString("http11processor.request.process"), t);
-            // 500 - Internal Server Error
-            response.setStatus(500);
-            adapter.log(request, response, 0);
             error = true;
+        } finally {
+            if (error) {
+                // 500 - Internal Server Error
+                response.setStatus(500);
+                adapter.log(request, response, 0);
+            }
         }
 
         rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
index 07cf61e..c277eab 100644 (file)
@@ -219,10 +219,13 @@ public class Http11NioProcessor extends AbstractHttp11Processor {
         } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);
             log.error(sm.getString("http11processor.request.process"), t);
-            // 500 - Internal Server Error
-            response.setStatus(500);
-            adapter.log(request, response, 0);
             error = true;
+        } finally {
+            if (error) {
+                // 500 - Internal Server Error
+                response.setStatus(500);
+                adapter.log(request, response, 0);
+            }
         }
 
         rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
index 6c80fd0..852eba4 100644 (file)
@@ -396,10 +396,13 @@ public class Http11Processor extends AbstractHttp11Processor {
         } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);
             log.error(sm.getString("http11processor.request.process"), t);
-            // 500 - Internal Server Error
-            response.setStatus(500);
-            adapter.log(request, response, 0);
             error = true;
+        } finally {
+            if (error) {
+                // 500 - Internal Server Error
+                response.setStatus(500);
+                adapter.log(request, response, 0);
+            }
         }
 
         rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
index dcf596b..9f7a79c 100644 (file)
         ServletRequestListener implementations to read the request body. Based
         on a patch by Simon Olofsson. (markt)
       </fix>
+      <fix>
+        Ensure an access log entry is made if an error occurs during
+        asynchronous request processing and the socket is immediately closed.
+        (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">