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 426eb12991 Fix some error reporting
426eb12991 is described below
commit 426eb12991be8e13fcc656fad78ffc2836760961
Author: remm <[email protected]>
AuthorDate: Wed Sep 20 15:43:55 2023 +0200
Fix some error reporting
When a method is matched but access is not possible, null could be
returned instead of the normal exception.
Found by coverity.
---
java/org/apache/el/util/ReflectionUtil.java | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/el/util/ReflectionUtil.java
b/java/org/apache/el/util/ReflectionUtil.java
index 22d2cee89a..226fc2af7d 100644
--- a/java/org/apache/el/util/ReflectionUtil.java
+++ b/java/org/apache/el/util/ReflectionUtil.java
@@ -252,7 +252,13 @@ public class ReflectionUtil {
// If a method is found where every parameter matches exactly,
// and no vars args are present, return it
if (exactMatch == paramCount && varArgsMatch == 0) {
- return getMethod(base.getClass(), base, m);
+ Method result = getMethod(base.getClass(), base, m);
+ if (result == null) {
+ throw new MethodNotFoundException(MessageFactory.get(
+ "error.method.notfound", base, property,
+ paramString(paramTypes)));
+ }
+ return result;
}
candidates.put(m, new MatchResult(
@@ -299,7 +305,13 @@ public class ReflectionUtil {
paramString(paramTypes)));
}
- return getMethod(base.getClass(), base, match);
+ Method result = getMethod(base.getClass(), base, match);
+ if (result == null) {
+ throw new MethodNotFoundException(MessageFactory.get(
+ "error.method.notfound", base, property,
+ paramString(paramTypes)));
+ }
+ return result;
}
/*
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]