[tomcat] branch master updated: 64149: Avoid NPE when using the access log valve without a pattern

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[tomcat] branch master updated: 64149: Avoid NPE when using the access log valve without a pattern

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

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


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

commit 60a7af2cbad19d4ebc76599c93fa9818679626c0
Author: remm <[hidden email]>
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 9776097..fe3fee1 100644
--- a/java/org/apache/catalina/valves/AbstractAccessLogValve.java
+++ b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
@@ -685,8 +685,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 14738ab..3111146 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: [hidden email]
For additional commands, e-mail: [hidden email]