tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nitkalya Wiriyanuparb (Ing)" <dekpi...@gmail.com>
Subject Re: BeanELResolver issue – calling a varargs method with no argument
Date Sun, 24 Dec 2017 00:06:41 GMT

On 24 Dec 2017, 3:08 AM +1300, Mark Thomas <markt@apache.org>, wrote:
> On 19/12/17 13:13, Mark Thomas wrote:
> > On 18 December 2017 03:32:40 GMT+00:00, Nitkalya Wiriyanuparb <dekpient@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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

Thanks for looking into it and providing such a detailed explanation. I also think it’s
not worth changing at this point – especially if you believe it might create a problem unexpectedly.

Merry Christmas & Happy New Year
Ing


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message