You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2016/11/29 21:36:14 UTC

[Bug 60431] New: EL function varargs with array

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

            Bug ID: 60431
           Summary: EL function varargs with array
           Product: Tomcat 6
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: apache@ben.eflow.org
  Target Milestone: default

The varargs implementation of the ASTFunction treats arrays in the final
parameter as a single parameter. 

Example jsp:

<%@ taglib uri="/myfunctions" prefix="myfn"%>
<c:set var="myarray" value="${myfn:split( myvar, '@' )}")
<c:set var="pageTitle" value="${myfn:getTitle( myobj, myarray )}"/>

myfunctions.java has:
public static String getTitle(String key, String... args) { }

The array passed in jsp should be treated as the whole argument to getTitle. 
The current implementation converts the passed array to be the first element in
a new array and passes that to getTitle.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60431] EL function varargs with array

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60431

--- Comment #4 from Ben <ap...@ben.eflow.org> ---
The java list --> array is not strictly necessary. I only added that in while
writing the test cases.  I wanted a simple test case like "fn:echo(['a',
'b'])", but el converts raw [] to a List, not an array.  

In order for the param to remain an array I have to put it into a separate
variable and pass that variable (which is actually my use-case).  See other
test-case that does this.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60431] EL function varargs with array

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60431

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
In addition to fixing this issue, the proposed patch also converts a List into
a set of varargs parameters. What is the specification based justification for
this? I can see why one would want to do this but Java doesn't do this and I
couldn't find any reference to this conversion in the UEL spec.

I'm working on the array to varargs mapping which, in my view, is justified by
how Java behaves even through the UEL spec doesn't mention it.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60431] EL function varargs with array

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60431

Ben <ap...@ben.eflow.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |apache@ben.eflow.org

--- Comment #1 from Ben <ap...@ben.eflow.org> ---
Created attachment 34489
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34489&action=edit
AstFunction patch

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60431] EL function varargs with array

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60431

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #5 from Mark Thomas <ma...@apache.org> ---
Thanks for the patch.

Fixed in:
- trunk for 9.0.0.M14 onwards
- 8.5.x for 8.5.9 onwards
- 8.0.x for 8.0.40 onwards
- 7.0.x for 7.0.74 onwards
- 6.0.x for 6.0.49 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60431] EL function varargs with array

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60431

--- Comment #2 from Ben <ap...@ben.eflow.org> ---
Attached patch against trunk to fix this.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org