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

            Bug ID: 60844
           Summary: ArrayIndexOutOfBoundsException when matching
                    actionListener
           Product: Tomcat 8
           Version: 8.5.x-trunk
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: EL
          Assignee: dev@tomcat.apache.org
          Reporter: the.daniel.g...@gmail.com
  Target Milestone: ----

Created attachment 34814
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34814&action=edit
SVN diff of fix on Apache Tomcat 8.5.x-trunk repo

The bug manifested itself when I:
1. Created a custom composite control in JSF.
2. *ERRONEOUSLY* Defined an attribute with a method signature of "void
actionListener(object)" -- it should have been "void
actionListener(javax.faces.event.AjaxBehaviorEvent)".
3. Trigger a call on the method through JSF.

When matching the method signature, org.apache.el.util.ReflectionUtil throws an
ArrayIndexOutOfBoundsException at line 210.

The bug is due to is missing check that paramValues is empty (it only checks if
it is not null, and then proceeds to evaluate paramValues[i]). I have
downloaded & compiled the Apache Tomcat 8.5.x trunk code, fixed the bug, and
tested it by running my app inside the servlet, and it now correctly gives an
error about it not finding the desired method that I have bound to the
argument.

*IMPROVEMENT SUGGESTION*:

The exception or error message should be more explicit about that EL first
looks for a method by the name and then the property. I got really mad after a
while wondering *WHY IS IT LOOKING FOR THE PROPERTY IF I EXPLICITLY SAID IT WAS
A METHOD?!?!?*, which led to the tinkering with the signature, which led to the
small bug discovery. It's just that it's not obvious (from outside) what Tomcat
is doing and I think it would be nice to indicate that somehow.

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