tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: BeanELResolver issue – calling a varargs method with no argument
Date Fri, 08 Dec 2017 14:34:54 GMT
On 07/12/17 15:00, Mark Thomas wrote:
> On 07/12/17 02:52, Nitkalya (Ing) Wiriyanuparb wrote:
>> Hello.
>>
>> I'm upgrading from Tomcat 7.0.30 to 8.5.24. Everything is working fine, but
>> I notice that BeanELResolver behaves differently when calling a bean
>> varargs method with no argument.
>>
>> My action bean has a method with the signature "public String
>> getIncludes(final String... moduleNames)". I'm calling it on one of my JSP
>> pages like "${actionBean.getIncludes()}", but got MethodNotFoundException.
>> Calling it with some arguments or an empty array would work – as one would
>> expect. Please see the stacktrace below.
>>
>> This method call used to be okay in 7.0.30. I've tried to find something in
>> the EL and JSP specifications around varargs, but couldn't find anything
>> concrete. I got the impression that it's not officially supported in the
>> specs, but Tomcat supports it.
>>
>> I'm treating it as a bug as I've already created a patch for it – see
>> below. However, I'm new to this mailing list so I thought I would ask first.
>>
>> Is this a bug?
> 
> It looks like it, yes.
> 
> Thanks for the patch. Note it is usually best to attach patches to a
> Bugzilla issue as that prevents them from getting mangled by e-mail clients.
> 
> I'll take a closer look at this now.

Thanks again for reporting the issue and providing a patch.

I've applied your patch with a few changes and additions.

The provided test cases highlighted the complexity of matching varargs
methods, particularly because of the coercion rules that apply in EL. I
expanded the tests significantly to try and cover all the edge cases. I
extended the proposed patch to cover those edge cases as well.

The changes will are in:
- trunk for 9.0.3 onwards
- 8.5.x for 8.5.25 onwards
- 8.0.x for 8.0.49 onwards

Mark

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


Mime
View raw message