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

            Bug ID: 57855
           Summary: Invoke MethodExpression with wrong pram count results
                    in ArrayIndexOutOfBoundsException
           Product: Tomcat 8
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: EL
          Assignee: dev@tomcat.apache.org
          Reporter: christian.stre...@ivyteam.ch

To reproduce add the following test code to TestMethodExpressionImpl:

@Test(expected=IllegalArgumentException.class)
public void test() {
    MethodExpression me = factory.createMethodExpression(context,
            "${beanAA.echo2}", null , new Class[]{String.class});
    me.invoke(context, new Object[0]);
}

The result is an ArrayIndexOutOfBoundsException. I would expect an
IllegalArgumentException or a MethodNotFoundException.
The same I would expect if I invoke with null:

@Test(expected=IllegalArgumentException.class)
public void testNull() {
    MethodExpression me = factory.createMethodExpression(context,
            "${beanAA.echo2}", null , new Class[]{String.class});
    me.invoke(context, null);
}

But this throws a NullPointerException instead.
I run into this because PrimeFaces handles AjaxListeners relatively bad and
expect that there is a MethodNotFoundException or an IllegalArgumentException
if they call a listener method with no pram.

try {
    listener.invoke(elContext, new Object[]{});
} 
catch (MethodNotFoundException mnfe) {
    processArgListener(context, elContext, event);
} 
catch (IllegalArgumentException iae) {
    processArgListener(context, elContext, event);
}

-- 
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