Bug 56638 - EL defineFunction does not support empty function names
Summary: EL defineFunction does not support empty function names
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: EL (show other bugs)
Version: 8.0.x-trunk
Hardware: PC All
: P2 normal (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-18 16:40 UTC by Arthur Fiedler
Modified: 2014-06-18 18:53 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arthur Fiedler 2014-06-18 16:40:44 UTC
Per the javadoc at http://docs.oracle.com/javaee/7/api/javax/el/ELProcessor.html it specifies that defineFunction(String prefix, String function, String className, String method) should use the method name as function name when the function argument is empty ("")

The current code stores function names as ":" so it cannot locate custom functions like the following ${length(obj)} which would be queried for as ":length"

Replace code:

if (method.getName().equals(sig.getName())) {
    if (sig.getParamTypeNames() == null) {

With:

if (method.getName().equals(sig.getName())) {
    if (function.length() == 0)
        function = method.getName();
    if (sig.getParamTypeNames() == null) {


The two new lines of code ensure that when function is blank it the method name will be used as the function name
Comment 1 Mark Thomas 2014-06-18 18:53:58 UTC
Thanks for the report. This has been fixed in 8.0.x for 8.0.9 onwards.