View | Details | Raw Unified | Return to bug 44294
Collapse All | Expand All

(-)org/apache/el/parser/AstFunction.java (-2 / +12 lines)
Lines 95-106 Link Here
95
        Object result = null;
95
        Object result = null;
96
        int numParams = this.jjtGetNumChildren();
96
        int numParams = this.jjtGetNumChildren();
97
        if (numParams > 0) {
97
        if (numParams > 0) {
98
            params = new Object[numParams];
98
            params = new Object[paramTypes.length];
99
            try {
99
            try {
100
                for (int i = 0; i < numParams; i++) {
100
                int lastParam  = m.isVarArgs() ? paramTypes.length - 1 : numParams;
101
                for (int i = 0; i < lastParam ; i++) {
101
                    params[i] = this.children[i].getValue(ctx);
102
                    params[i] = this.children[i].getValue(ctx);
102
                    params[i] = coerceToType(params[i], paramTypes[i]);
103
                    params[i] = coerceToType(params[i], paramTypes[i]);
103
                }
104
                }
105
                if (m.isVarArgs()) {
106
                    Class componentType = paramTypes[lastParam].getComponentType();
107
                    Object varArgs = java.lang.reflect.Array.newInstance(componentType, numParams - lastParam);
108
                    for (int i = lastParam; i < numParams; i++) {
109
                        Object param = this.children[i].getValue(ctx);
110
                        java.lang.reflect.Array.set(varArgs, i - lastParam , coerceToType(param, componentType));
111
                    }
112
                    params[lastParam] = varArgs;
113
                }
104
            } catch (ELException ele) {
114
            } catch (ELException ele) {
105
                throw new ELException(MessageFactory.get("error.function", this
115
                throw new ELException(MessageFactory.get("error.function", this
106
                        .getOutputName()), ele);
116
                        .getOutputName()), ele);

Return to bug 44294