tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: svn commit: r1503857 - in /tomcat/trunk: java/javax/el/ java/org/apache/el/parser/ test/org/apache/el/parser/
Date Wed, 17 Jul 2013 13:30:12 GMT
On 17/07/2013 12:43, Mark Thomas wrote:
> Violeta Georgieva <milesg78@gmail.com> wrote:
> 
>> Having the example from the test:
>> (x->y->x-y)(2)(1)
>>
>> We may transform it like this:
>> (()->y->2-y)()(1)
>>
>> So instead of returning right way when formalParameters.isEmpty()
>>
>> Shouldn't we have something like the one below in order to continue
>> evaluation of the nested expression:
>>
>>
>>
>> --- org/apache/el/parser/AstLambdaExpression.java (revision 1504024)
>> +++ org/apache/el/parser/AstLambdaExpression.java (working copy)
>> @@ -54,9 +54,12 @@
>>      LambdaExpression le = new LambdaExpression(formalParameters, ve);
>>         le.setELContext(ctx);
>>
>> +        Object result = le;
>> +        int i = 2;
>>         if (formalParameters.isEmpty()) {
>>             // No formal parameters - invoke the expression
>> -            return le.invoke(ctx, (Object[]) null);
>> +            result = ((LambdaExpression) result).invoke(ctx,
>> (Object[])
>> null);
>> +            i++;
>>         }
>>
>>       // If there are method parameters, need to invoke the expression
>> with
>> @@ -64,8 +67,6 @@
>>         // should be that many nested expressions.
>>      // If there are more nested expressions that parameters this will
>> return
>>         // a LambdaExpression
>> -        Object result = le;
>> -        int i = 2;
>>         while (result instanceof LambdaExpression && i <
>> jjtGetNumChildren()) {
>>             result = ((LambdaExpression) result).invoke(
>>                     ((AstMethodParameters)
>> children[i]).getParameters(ctx));
> 
> I agree the current solution isn't right but I have some local test cases that I'm fairly
sure will still fail with the above patch. I'm working on a fix and should have something
to commit soon.

Fix applied. What do you think?

Mark


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


Mime
View raw message