This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push: new d3c6c7a00b Fix NPE causing a failure to match d3c6c7a00b is described below commit d3c6c7a00b9a5a171710f58e679b17f3b5ca15cd 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 f2cbf785f6..7ea1964b72 100644 --- a/java/org/apache/tomcat/util/IntrospectionUtils.java +++ b/java/org/apache/tomcat/util/IntrospectionUtils.java @@ -429,8 +429,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 bc3257c93f..977e085e3a 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