tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoli...@apache.org
Subject svn commit: r1030253 - /tomcat/trunk/java/org/apache/catalina/core/StandardEngine.java
Date Tue, 02 Nov 2010 22:04:44 GMT
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message