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 d4905f9979 Fix some error reporting d4905f9979 is described below commit d4905f99790969c9ddabce9ddd9672fb5c2431e0 Author: remm <r...@apache.org> 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 57e651646e..9d9d0f4d93 100644 --- a/java/org/apache/el/util/ReflectionUtil.java +++ b/java/org/apache/el/util/ReflectionUtil.java @@ -250,7 +250,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( @@ -297,7 +303,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: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org