From: kkolinko Date: Fri, 4 Feb 2011 03:07:37 +0000 (+0000) Subject: Fix NPE in CoyoteAdapter when postParseRequest() call fails. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=fd56a5a59f73202e8935265e13028c80db271918;p=tomcat7.0 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. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1067072 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java b/java/org/apache/catalina/connector/CoyoteAdapter.java index 59f8c457d..153788f91 100644 --- a/java/org/apache/catalina/connector/CoyoteAdapter.java +++ b/java/org/apache/catalina/connector/CoyoteAdapter.java @@ -375,7 +375,8 @@ public class CoyoteAdapter implements Adapter { // 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 Adapter { 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); } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 3a61fd299..c0f994d8d 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -41,6 +41,15 @@ +
+ + + + Fix NPE in CoyoteAdapter when postParseRequest() call fails. (kkolinko) + + + +