Bug 44294

Summary: Support for EL functions with varargs
Product: Tomcat 6 Reporter: Tuomas Kiviaho <tuomas.kiviaho>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: 6.0.14   
Target Milestone: default   
Hardware: Other   
OS: other   
Attachments: AstFunction.patch
AstFunction.patch
ExpressionBuilder.patch
alternative.patch
FunctionMapperImpl.patch

Description Tuomas Kiviaho 2008-01-25 02:39:33 UTC
Varargs <http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html> could
be supported easily since it is possible to retrieve the information whether or
not method has vargargs and vararg can only exist as last argument.
Comment 1 Tuomas Kiviaho 2008-01-25 02:44:16 UTC
Created attachment 21426 [details]
AstFunction.patch
Comment 2 Tuomas Kiviaho 2008-02-19 23:50:03 UTC
Created attachment 21567 [details]
AstFunction.patch
Comment 3 Tuomas Kiviaho 2008-02-20 02:48:13 UTC
Created attachment 21569 [details]
ExpressionBuilder.patch

ExpressionBuilder has parameter length check that has to deal with var args as
well. I think this is premature validation as the purpose of visitor is merely
to populate variable mapper and function resolver. I believe it would be more
consistent move this check to AstFunction.

Please note that JSP translation time validation is done at
org.apache.jasper.compiler.Validator.ValidateVisitor.getFunctionMapper. Vararg
support could/should be implemented these as well.
Comment 4 Tuomas Kiviaho 2008-02-20 03:11:58 UTC
Created attachment 21570 [details]
alternative.patch

Alternative approach where logic from ExpressionBuilder is moved to AstFunction
Comment 5 Tuomas Kiviaho 2008-02-26 05:42:44 UTC
Created attachment 21593 [details]
FunctionMapperImpl.patch

java.lang.NullPointerException
	at
org.apache.el.lang.FunctionMapperImpl.resolveFunction(FunctionMapperImpl.java:53)

	at org.apache.el.parser.AstFunction.getValue(AstFunction.java:87)

alternative.patch revealed that FunctionMapperImpl doesn't quite comply with
the API
Comment 6 Mark Thomas 2016-12-01 20:59:46 UTC
Fixed by back-porting existing support from 8.0.x

Fixed in:
- 7.0.x for 7.0.74 onwards
- 6.0.x for 6.0.49 onwards