Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48914
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 4 Apr 2010 10:09:18 +0000 (10:09 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 4 Apr 2010 10:09:18 +0000 (10:09 +0000)
Invoke should use parameters provided in expression in preference to parameters provided in invoke() call

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@930653 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/el/parser/AstValue.java

index 1c37387..a0ce1d7 100644 (file)
@@ -216,11 +216,23 @@ public final class AstValue extends SimpleNode {
     public Object invoke(EvaluationContext ctx, 
             @SuppressWarnings("unchecked") Class[] paramTypes,
             Object[] paramValues) throws ELException {
+        
         Target t = getTarget(ctx);
-        Method m = ReflectionUtil.getMethod(t.base, t.property, paramTypes);
+        Method m = null;
+        Object[] values = null;
+        if (isParametersProvided()) {
+            Class<?>[] types = ((AstMethodParameters)
+                    this.jjtGetChild(2)).getParameterTypes(ctx);
+            values = ((AstMethodParameters)
+                    this.jjtGetChild(2)).getParameters(ctx);
+            m = ReflectionUtil.getMethod(t.base, t.property, types);
+        } else {
+            m = ReflectionUtil.getMethod(t.base, t.property, paramTypes);
+            values = paramValues;
+        }
         Object result = null;
         try {
-            result = m.invoke(t.base, paramValues);
+            result = m.invoke(t.base, values);
         } catch (IllegalAccessException iae) {
             throw new ELException(iae);
         } catch (IllegalArgumentException iae) {