Author: kkolinko
Date: Tue Nov  2 22:04:44 2010
New Revision: 1030253

URL: http://svn.apache.org/viewvc?rev=1030253&view=rev
Log:
Improve handling of nulls in StandardEngine.logAccess()

This takes care of the case when findChild(getDefaultHost()) returns null.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/StandardEngine.java

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardEngine.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardEngine.java?rev=1030253&r1=1030252&r2=1030253&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardEngine.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardEngine.java Tue Nov  2 
22:04:44 2010
@@ -313,26 +313,27 @@ public class StandardEngine extends Cont
         }
 
         if (!logged && useDefault) {
-            Host host = null;
             if (defaultAccessLog == null) {
                 // If we reached this point, this Engine can't have an 
AccessLog
                 // Look in the defaultHost
-                host = (Host) findChild(getDefaultHost());
-                defaultAccessLog = host.getAccessLog();
-
-                if (defaultAccessLog == null) {
-                    // Try the ROOT context of default host
-                    Context context = (Context) host.findChild("");
-                    if (context != null) {
-                        defaultAccessLog = context.getAccessLog();
-                    }
+                Host host = (Host) findChild(getDefaultHost());
+                if (host != null) {
+                    defaultAccessLog = host.getAccessLog();
 
                     if (defaultAccessLog == null) {
-                        defaultAccessLog = new NoopAccessLog();
+                        // Try the ROOT context of default host
+                        Context context = (Context) host.findChild("");
+                        if (context != null) {
+                            defaultAccessLog = context.getAccessLog();
+                        }
                     }
                 }
+
+                if (defaultAccessLog == null) {
+                    defaultAccessLog = new NoopAccessLog();
+                }
             }
-            
+
             defaultAccessLog.log(request, response, time);
         }
     }



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

Reply via email to