This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 0c1f669  64149: Avoid NPE when using the access log valve without a 
pattern
0c1f669 is described below

commit 0c1f669512f8d8c1a91e3099f5992bae04d0b6de
Author: remm <r...@apache.org>
AuthorDate: Tue Mar 24 16:47:35 2020 +0100

    64149: Avoid NPE when using the access log valve without a pattern
    
    There was already a check for that on logElements in the log method,
    which is also null in that case. So cachedElements needs the same null
    check.
---
 java/org/apache/catalina/valves/AbstractAccessLogValve.java | 4 +++-
 webapps/docs/changelog.xml                                  | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/valves/AbstractAccessLogValve.java 
b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
index a55b289..51a771f 100644
--- a/java/org/apache/catalina/valves/AbstractAccessLogValve.java
+++ b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
@@ -682,8 +682,10 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
             // to be cached in the request.
             request.getAttribute(Globals.CERTIFICATES_ATTR);
         }
-        for (CachedElement element : cachedElements) {
+        if (cachedElements != null) {
+            for (CachedElement element : cachedElements) {
                 element.cache(request);
+            }
         }
         getNext().invoke(request, response);
     }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 9fb432e..4865f72 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -62,6 +62,10 @@
         format is reused. Test case submitted by Gary Thomas. (remm)
       </fix>
       <fix>
+        <bug>64149</bug>: Avoid NPE when using the access log valve without
+        a pattern. (remm)
+      </fix>
+      <fix>
         <bug>64247</bug>: Using a wildcard for <code>jarsToSkip</code> should
         not override a possibly present <code>jarsToScan</code>. Based on code
         submitted by Iridias. (remm)


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

Reply via email to