This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 58367d2891 Fix NPE causing a failure to match
58367d2891 is described below
commit 58367d289173d8d0ef512cf4d320ec8226fc0ea9
Author: remm <[email protected]>
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 6647498939..c477dbd880 100644
--- a/java/org/apache/tomcat/util/IntrospectionUtils.java
+++ b/java/org/apache/tomcat/util/IntrospectionUtils.java
@@ -424,8 +424,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 888c126076..b2e8edf1c8 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: [email protected]
For additional commands, e-mail: [email protected]