Bug 42444

Summary: Potential NullPointerException in org.apache.catalina.valves.AccessLogValve
Product: Tomcat 6 Reporter: Nils Hammar <m4341>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 6.0.11   
Target Milestone: default   
Hardware: All   
OS: other   

Description Nils Hammar 2007-05-17 08:15:53 UTC
In the class AccessLogValve.RequestElement in the method addElement there is an
access of the form: request.getProtocol(), even though the variable request is
known to be 'null' which will cause a NullPointerException.

Patch below:
---

Index:
F:/Workspace/Apache2/tomcat6/java/org/apache/catalina/valves/AccessLogValve.java
===================================================================
---
F:/Workspace/Apache2/tomcat6/java/org/apache/catalina/valves/AccessLogValve.java	(revision
538877)
+++
F:/Workspace/Apache2/tomcat6/java/org/apache/catalina/valves/AccessLogValve.java	(working
copy)
@@ -1035,7 +1035,7 @@
                 buf.append(request.getProtocol());
             } else {
                 buf.append("- - ");
-                buf.append(request.getProtocol());
+                // buf.append(request.getProtocol());
             }
         }
     }
Comment 1 Tim Funk 2007-05-19 11:31:53 UTC
Committed in revision 539787.

thanks!