Author: kkolinko Date: Sun Nov 7 05:22:24 2010 New Revision: 1032213 URL: http://svn.apache.org/viewvc?rev=1032213&view=rev Log: Two followup fixes for r1030188 (BZ 49909) Avoid NPEs in StandardEngine. Add logging in one missed case.
Modified: tomcat/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardEngine.java tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1032213&r1=1032212&r2=1032213&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Sun Nov 7 05:22:24 2010 @@ -157,23 +157,6 @@ PATCHES PROPOSED TO BACKPORT: when I go from JRE selection page to the next page in TC7 installer. kkolinko: merging r1027504 does not perform cleanly -* Additional minor patch / followup to r1030188 - Add logging for some rare case in Http11Processor.parseHost() - To reproduce, send a HTTP/1.1 request with an invalid value for the port - number in the Host header. - http://people.apache.org/~kkolinko/patches/2010-11-03_tc6_49099_Http11Processor.patch - +1: kkolinko,funkman,markt - -1: - -* Followup to r1030188 - Avoid NPE in StandardEngine.logAccess(..) if default host or its ROOT - context are null. - To reproduce, start Tomcat without the ROOT webapp and make an invalid - request. An NPE happens. It is backport of r966570, r1030253. - http://people.apache.org/~kkolinko/patches/2010-11-03_tc6_49099_StandardEngine.patch - +1: kkolinko, funkman, markt - -1: - * Fix for BZ 48925: request.getLocalAddr() returns "null" It only happens for the old ajp implementation, so no fix for TC 7 needed. Copy local addr from local name just as we do in the ajp processor Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardEngine.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardEngine.java?rev=1032213&r1=1032212&r2=1032213&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardEngine.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardEngine.java Sun Nov 7 05:22:24 2010 @@ -496,24 +496,27 @@ public class StandardEngine } 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(""); - 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); } } Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java?rev=1032213&r1=1032212&r2=1032213&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java Sun Nov 7 05:22:24 2010 @@ -1418,6 +1418,7 @@ public class Http11Processor implements error = true; // 400 - Bad request response.setStatus(400); + adapter.log(request, response, 0); break; } port = port + (charValue * mult); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org