On 19/12/17 13:13, Mark Thomas wrote:
> On 18 December 2017 03:32:40 GMT+00:00, Nitkalya Wiriyanuparb 
> <dekpi...@gmail.com> wrote:
> 
> <snip/>
> 
>> Tested with my system – everything’s awesome. I can also confirm that
>> the edge case I mentioned is valid; calling the varargs method with an
>> array ${actionBean.getIncludes([“something"])} doesn’t coerce
>> correctly. I personally don’t care about this use case, so I’ll leave
>> it to the maintainers to decide. :)
> 
> Thanks for confirming the fix.
> 
> Personally, edge cases not working correctly bugs me so I've added this to my 
> TODO list.

I've taken a look at this and it is a sufficiently grey area that I'm
not intending to make any changes at this point.

The problem is that ["something"] isn't an array with a single element,
it is a List with a single element. The EL spec doesn't mention any
coercion rules for Lists or varargs.

What we have tried to implement so far is to first apply the normal Java
rules and if they don't work coerce the parameters and try again. The
additional coercion steps sometimes create ambiguity. In that case we fail.

For this specific case we currently coerce List<String> to a String and
then treat it as a single argument.

We could coerce the List elements individually but there is nothing in
the EL spec to suggest that that is correct behaviour. I can see how it
could be expected but given that a) the spec doesn't mention it; b) it
isn't a problem for you; and c) changing it might cause a problem for
others; I'm going to leave things as they are. We can always re-evaluate
that choice at a later date.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to