This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new ef04ec2d3f Fix NPE causing a failure to match ef04ec2d3f is described below commit ef04ec2d3f63c612bbe771b9e9536f4c7b5a2cb7 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 45c261c2ad..bacda81eb2 100644 --- a/java/org/apache/tomcat/util/IntrospectionUtils.java +++ b/java/org/apache/tomcat/util/IntrospectionUtils.java @@ -423,8 +423,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 312ac6362b..6e13af1c67 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