https://bz.apache.org/bugzilla/show_bug.cgi?id=60032

            Bug ID: 60032
           Summary: EL function resolve varargs values but not send it to
                    function call
           Product: Tomcat 8
           Version: 8.0.33
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: EL
          Assignee: dev@tomcat.apache.org
          Reporter: d02bern...@gmail.com

In method AstFunction#getValue,  the vargargs values are resolved and added to
named varargs variable. The  varargs variables is never added to the parameter
list used to call the method.

       if (inputParameterCount > 0) {
            params = new Object[methodParameterCount];
            try {
                for (int i = 0; i < methodParameterCount; i++) {
                    if (m.isVarArgs() && i == methodParameterCount - 1) {
                        if (inputParameterCount < methodParameterCount) {
                            params[i] = null;
                        } else {
                            Object[] varargs =
                                    new Object[inputParameterCount -
methodParameterCount + 1];
                            Class<?> target = paramTypes[i].getComponentType();
                            for (int j = i; j < inputParameterCount; j++) {
                                varargs[j-i] =
parameters.jjtGetChild(j).getValue(ctx);
                                varargs[j-i] = coerceToType(ctx, varargs[j-i],
target);
                            }
                        }
                    } else {
                        params[i] = parameters.jjtGetChild(i).getValue(ctx);
                        params[i] = coerceToType(ctx, params[i],
paramTypes[i]);
                    }
                }
            } catch (ELException ele) {
                throw new ELException(MessageFactory.get("error.function", this
                        .getOutputName()), ele);
            }
        }
        try {
            result = m.invoke(null, params);
        } catch (IllegalAccessException iae) {
            throw new ELException(MessageFactory.get("error.function", this
                    .getOutputName()), iae);
        } catch (InvocationTargetException ite) {
            Throwable cause = ite.getCause();
            if (cause instanceof ThreadDeath) {
                throw (ThreadDeath) cause;
            }
            if (cause instanceof VirtualMachineError) {
                throw (VirtualMachineError) cause;
            }
            throw new ELException(MessageFactory.get("error.function", this
                    .getOutputName()), cause);
        }
        return result;

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to