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

remm 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 f9744d4163 Fix NPE causing a failure to match
f9744d4163 is described below

commit f9744d4163761af318c1dfbd3fd10d1acbc91c91
Author: remm <r...@apache.org>
AuthorDate: Fri Sep 15 16:33:57 2023 +0200

    Fix NPE causing a failure to match
    
    If trying to match a no arg method and there's an attempt to match the
    same method name with some arguments.
    Found by coverity.
---
 java/org/apache/tomcat/util/IntrospectionUtils.java | 8 ++++++--
 webapps/docs/changelog.xml                          | 4 ++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/IntrospectionUtils.java 
b/java/org/apache/tomcat/util/IntrospectionUtils.java
index 33ce7fb920..58ebef56d3 100644
--- a/java/org/apache/tomcat/util/IntrospectionUtils.java
+++ b/java/org/apache/tomcat/util/IntrospectionUtils.java
@@ -381,8 +381,12 @@ public final class IntrospectionUtils {
         for (Method method : methods) {
             if (method.getName().equals(name)) {
                 Class<?> methodParams[] = method.getParameterTypes();
-                if (params == null && methodParams.length == 0) {
-                    return method;
+                if (params == null) {
+                    if (methodParams.length == 0) {
+                        return method;
+                    } else {
+                        continue;
+                    }
                 }
                 if (params.length != methodParams.length) {
                     continue;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index faeb276266..665c4daa63 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -129,6 +129,10 @@
         error handling process is only triggered once per asynchronous cycle.
         (markt)
       </fix>
+      <fix>
+        Fix logic issue trying to match no argument method in IntropectionUtil.
+        (remm)
+      </fix>
     </changelog>
   </subsection>
 </section>


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

Reply via email to