This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.0.x by this push: new 4b378e4 Fix copy/paste error 4b378e4 is described below commit 4b378e4765391465319c3ae945ac3a3fd623ee64 Author: Mark Thomas <ma...@apache.org> AuthorDate: Fri Sep 17 22:09:16 2021 +0100 Fix copy/paste error --- java/org/apache/el/parser/AstValue.java | 12 +++++------- test/org/apache/el/TestMethodExpressionImpl.java | 13 +++++++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/java/org/apache/el/parser/AstValue.java b/java/org/apache/el/parser/AstValue.java index 53ce2d6..df45810 100644 --- a/java/org/apache/el/parser/AstValue.java +++ b/java/org/apache/el/parser/AstValue.java @@ -214,13 +214,11 @@ public final class AstValue extends SimpleNode { Target t = getTarget(ctx); Class<?>[] types = null; if (isParametersProvided()) { - if (isParametersProvided()) { - Object[] values = ((AstMethodParameters) this.jjtGetChild( - this.jjtGetNumChildren() - 1)).getParameters(ctx); - types = getTypesFromValues(values); - } else { - types = paramTypes; - } + Object[] values = ((AstMethodParameters) this.jjtGetChild( + this.jjtGetNumChildren() - 1)).getParameters(ctx); + types = getTypesFromValues(values); + } else { + types = paramTypes; } Method m = ReflectionUtil.getMethod(ctx, t.base, t.property, types, null); return new MethodInfo(m.getName(), m.getReturnType(), m.getParameterTypes()); diff --git a/test/org/apache/el/TestMethodExpressionImpl.java b/test/org/apache/el/TestMethodExpressionImpl.java index 2178ce7..b878f5b 100644 --- a/test/org/apache/el/TestMethodExpressionImpl.java +++ b/test/org/apache/el/TestMethodExpressionImpl.java @@ -775,4 +775,17 @@ public class TestMethodExpressionImpl { Assert.assertEquals(1, mi.getParamTypes().length); Assert.assertEquals(String.class, mi.getParamTypes()[0]); } + + + @Test + public void testGetMethodInfo02() throws Exception { + MethodExpression me = factory.createMethodExpression(context, + "#{beanA.setName}", null, new Class[] { String.class } ); + // This is the call that failed + MethodInfo mi = me.getMethodInfo(context); + // The rest is to check it worked correctly + Assert.assertEquals(void.class, mi.getReturnType()); + Assert.assertEquals(1, mi.getParamTypes().length); + Assert.assertEquals(String.class, mi.getParamTypes()[0]); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org