Author: kkolinko
Date: Fri Feb  4 03:07:37 2011
New Revision: 1067072

URL: http://svn.apache.org/viewvc?rev=1067072&view=rev
Log:
Fix NPE in CoyoteAdapter when postParseRequest() call fails.

That was caused by mappingData.context being null.
This NPE occurence in 7.0.7 was reported on the users list.

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=1067072&r1=1067071&r2=1067072&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java Fri Feb  
4 03:07:37 2011
@@ -375,7 +375,8 @@ public class CoyoteAdapter implements Ad
             // Parse and set Catalina and configuration specific 
             // request parameters
             
req.getRequestProcessor().setWorkerThreadName(Thread.currentThread().getName());
-            if (postParseRequest(req, request, res, response)) {
+            boolean postParseSuccess = postParseRequest(req, request, res, 
response);
+            if (postParseSuccess) {
                 //check valves if we support async
                 
request.setAsyncSupported(connector.getService().getContainer().getPipeline().isAsyncSupported());
                 // Calling the container
@@ -406,9 +407,14 @@ public class CoyoteAdapter implements Ad
                 async = true;
             } else if (!comet) {
                 response.finishResponse();
-                ((Context) request.getMappingData().context).logAccess(request,
-                        response,
-                        System.currentTimeMillis() - req.getStartTime(), 
false);
+                if (postParseSuccess) {
+                    // Log only if processing was invoked.
+                    // If postParseRequest() failed, it has already logged it.
+                    ((Context) request.getMappingData().context).logAccess(
+                            request, response,
+                            System.currentTimeMillis() - req.getStartTime(),
+                            false);
+                }
                 req.action(ActionCode.POST_REQUEST , null);
             }
 

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1067072&r1=1067071&r2=1067072&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Feb  4 03:07:37 2011
@@ -41,6 +41,15 @@
 <!--
   General, Catalina, Coyote, Jasper, Cluster, Web applications, Extras, Other
 -->
+<section name="Tomcat 7.0.8 (markt)">
+  <subsection name="Catalina">
+    <changelog>
+      <fix>
+        Fix NPE in CoyoteAdapter when postParseRequest() call fails. (kkolinko)
+      </fix>
+    </changelog>
+  </subsection>
+</section>
 <section name="Tomcat 7.0.7 (markt)">
   <subsection name="Catalina">
     <changelog>



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

Reply via email to