This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit c5b3ee58258bef44736410be3ae59038b918235f Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Oct 3 21:49:34 2019 +0100 Remove unnecessary code. In Java 8 and earlier this code is never reached as the findWrapper method either returns the right constructor or throws an Exception. In Java 9 the code might return a constructor when it should throw a MethodNotFoundException but it will then throw IllegalAccessExceptioni when the constructor is used. This will be fixed shortly in a future commit. --- java/javax/el/Util.java | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/java/javax/el/Util.java b/java/javax/el/Util.java index cfe0c06..7302fe8 100644 --- a/java/javax/el/Util.java +++ b/java/javax/el/Util.java @@ -593,29 +593,22 @@ class Util { List<Wrapper> wrappers = Wrapper.wrap(constructors); - Wrapper result = findWrapper(clazz, wrappers, methodName, paramTypes, paramValues); + Wrapper wrapper = findWrapper(clazz, wrappers, methodName, paramTypes, paramValues); - return getConstructor(clazz, (Constructor<?>) result.unWrap()); + Constructor<?> constructor = getConstructor(clazz, (Constructor<?>) wrapper.unWrap()); + if (constructor == null) { + throw new MethodNotFoundException(message( + null, "util.method.notfound", clazz, methodName, + paramString(paramTypes))); + } + return constructor; } static Constructor<?> getConstructor(Class<?> type, Constructor<?> c) { - if (c == null || Modifier.isPublic(type.getModifiers())) { + if (Modifier.isPublic(type.getModifiers())) { return c; } - Constructor<?> cp = null; - Class<?> sup = type.getSuperclass(); - if (sup != null) { - try { - cp = sup.getConstructor(c.getParameterTypes()); - cp = getConstructor(cp.getDeclaringClass(), cp); - if (cp != null) { - return cp; - } - } catch (NoSuchMethodException e) { - // Ignore - } - } return null; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org