Bug 42444 - Potential NullPointerException in org.apache.catalina.valves.AccessLogValve
Potential NullPointerException in org.apache.catalina.valves.AccessLogValve
Status: RESOLVED FIXED
Product: Tomcat 6
Classification: Unclassified
Component: Catalina
6.0.11
All other
: P2 normal (vote)
: default
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2007-05-17 08:15 UTC by Nils Hammar
Modified: 2007-05-19 11:31 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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!