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 026256111f Fix issue returning null for no args, which would cause a NPE 026256111f is described below commit 026256111f0c1f7855d52be3ac9139bdd463e21c Author: remm <r...@apache.org> AuthorDate: Mon Jul 7 14:01:20 2025 +0200 Fix issue returning null for no args, which would cause a NPE Although the comment says that this duplicates jakarta.el.Util, this does not seem to be exactly the case. All paths should throw MethodNotFoundException instead of returning null. In jakarta.el.Util all callers are expecting null instead, so it works fine. Found by Coverity. --- java/org/apache/el/util/ReflectionUtil.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/java/org/apache/el/util/ReflectionUtil.java b/java/org/apache/el/util/ReflectionUtil.java index fce0396320..6d0ed432ca 100644 --- a/java/org/apache/el/util/ReflectionUtil.java +++ b/java/org/apache/el/util/ReflectionUtil.java @@ -155,12 +155,20 @@ public class ReflectionUtil { // Fast path: when no arguments exist, there can only be one matching method and no need for coercion. if (paramCount == 0) { + Method result = null; + Throwable t = null; try { Method method = clazz.getMethod(methodName, paramTypes); - return getMethod(clazz, base, method); + result = getMethod(clazz, base, method); } catch (NoSuchMethodException | SecurityException e) { - // Fall through to broader, slower logic + // Fall through + t = e; } + if (result == null) { + throw new MethodNotFoundException( + MessageFactory.get("error.method.notfound", base, property, paramString(paramTypes)), t); + } + return result; } Method[] methods = clazz.getMethods(); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org