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

markt 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 0483c93  Fix rare potential NPE identified by Coverity Scan.
0483c93 is described below

commit 0483c93ddd4ab0ac7742e154d1e1e1b3c4475f6c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri May 17 18:05:46 2019 +0100

    Fix rare potential NPE identified by Coverity Scan.
---
 java/org/apache/catalina/connector/CoyoteAdapter.java | 6 ++++--
 webapps/docs/changelog.xml                            | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java 
b/java/org/apache/catalina/connector/CoyoteAdapter.java
index fb4c236..de572e6 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -816,7 +816,7 @@ public class CoyoteAdapter implements Adapter {
             if (wrapper != null) {
                 String[] methods = wrapper.getServletMethods();
                 if (methods != null) {
-                    for (int i=0; i<methods.length; i++) {
+                    for (int i=0; i < methods.length; i++) {
                         if ("TRACE".equals(methods[i])) {
                             continue;
                         }
@@ -828,7 +828,9 @@ public class CoyoteAdapter implements Adapter {
                     }
                 }
             }
-            res.addHeader("Allow", header);
+            if (header != null) {
+                res.addHeader("Allow", header);
+            }
             response.sendError(405, "TRACE method is not allowed");
             // Safe to skip the remainder of this method.
             return true;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 712c698..24cc2b0 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -72,6 +72,10 @@
         Ensure that the default servlet reads the entire global XSLT file if
         one is defined. Identified by Coverity Scan. (markt)
       </fix>
+      <fix>
+        Avoid potential <code>NullPointerException</code> when generating an
+        HTTP <code>Allow</code> header. Identified by Coverity Scan. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


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

Reply via email to