You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mg...@apache.org on 2020/02/19 12:41:02 UTC
[tomcat] branch 8.5.x updated: Check for non-null 'methods'
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push:
new 84abf86 Check for non-null 'methods'
84abf86 is described below
commit 84abf86f24142f1790b9cf5a31b8cce94822c8ce
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Wed Feb 19 14:39:49 2020 +0200
Check for non-null 'methods'
... because javax.servlet.http.HttpServlet#getAllDeclaredMethods(Class) returns 'null' when the class is j.servlet.http.HttpServlet
(cherry picked from commit f85638784471b80da82fc4ef89b3424698da981b)
---
java/javax/servlet/http/HttpServlet.java | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/java/javax/servlet/http/HttpServlet.java b/java/javax/servlet/http/HttpServlet.java
index aedbee6..2ac26cf 100644
--- a/java/javax/servlet/http/HttpServlet.java
+++ b/java/javax/servlet/http/HttpServlet.java
@@ -502,19 +502,21 @@ public abstract class HttpServlet extends GenericServlet {
}
// End of Tomcat specific hack
- for (int i=0; i<methods.length; i++) {
- Method m = methods[i];
+ if (methods != null) {
+ for (int i = 0; i < methods.length; i++) {
+ Method m = methods[i];
- if (m.getName().equals("doGet")) {
- ALLOW_GET = true;
- ALLOW_HEAD = true;
+ if (m.getName().equals("doGet")) {
+ ALLOW_GET = true;
+ ALLOW_HEAD = true;
+ }
+ if (m.getName().equals("doPost"))
+ ALLOW_POST = true;
+ if (m.getName().equals("doPut"))
+ ALLOW_PUT = true;
+ if (m.getName().equals("doDelete"))
+ ALLOW_DELETE = true;
}
- if (m.getName().equals("doPost"))
- ALLOW_POST = true;
- if (m.getName().equals("doPut"))
- ALLOW_PUT = true;
- if (m.getName().equals("doDelete"))
- ALLOW_DELETE = true;
}
String allow = null;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org