Avoid possible NPE
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 8 Jun 2011 13:52:50 +0000 (13:52 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 8 Jun 2011 13:52:50 +0000 (13:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1133401 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/connector/CoyoteAdapter.java
webapps/docs/changelog.xml

index e691eca..7fef9b9 100644 (file)
@@ -26,6 +26,7 @@ import javax.servlet.RequestDispatcher;
 import javax.servlet.SessionTrackingMode;
 
 import org.apache.catalina.Context;
+import org.apache.catalina.Host;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.comet.CometEvent;
 import org.apache.catalina.comet.CometEvent.EventType;
@@ -642,7 +643,11 @@ public class CoyoteAdapter implements Adapter {
                 res.setStatus(404);
                 res.setMessage("Not found");
                 // No context, so use host
-                request.getHost().logAccess(request, response, 0, true);
+                Host host = request.getHost();
+                // Make sure there is a host (might not be during shutdown)
+                if (host != null) {
+                    host.logAccess(request, response, 0, true);
+                }
                 return false;
             }
         
index 39db3c8..34374e6 100644 (file)
         Enable remaining valves for Servlet 3 asynchronous processing support.
         (markt)
       </fix>
+      <fix>
+        Avoid possible NPE when logging requests received during embedded Tomcat
+        shutdown. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">