[ 
https://issues.apache.org/jira/browse/JEXL-403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759998#comment-17759998
 ] 

Xu Pengcheng commented on JEXL-403:
-----------------------------------

I tried at my side and found the problem is caused by setting cache size > 0.
{code:java}
new Engine(new JexlBuilder().cache(100)); {code}
 

BTW, I read the comment of this method but not quite understand what is in 
cache, can you please provide more explanation?

Thanks a lot!

 

 

> Failed while evaluating template in loop.
> -----------------------------------------
>
>                 Key: JEXL-403
>                 URL: https://issues.apache.org/jira/browse/JEXL-403
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.3
>            Reporter: Xu Pengcheng
>            Assignee: Henri Biestro
>            Priority: Major
>
> code:
> {code:java}
> var a = {'a': 1};
> var list = [a, a];
> let map1 = {:};
> for (var item : list) {
>   map1[`${item.a}`] = 1;
> } {code}
> The fist iteration is ok, but failed at the second time.
> error stack
> {code:java}
> Caused by: java.lang.ClassCastException: class 
> org.apache.commons.jexl3.internal.introspection.MapSetExecutor cannot be cast 
> to class org.apache.commons.jexl3.internal.TemplateEngine$TemplateExpression 
> (org.apache.commons.jexl3.internal.introspection.MapSetExecutor and 
> org.apache.commons.jexl3.internal.TemplateEngine$TemplateExpression are in 
> unnamed module of loader 'app')
>     at 
> org.apache.commons.jexl3.internal.Interpreter.visit(Interpreter.java:1909)
>     at 
> org.apache.commons.jexl3.parser.ASTJxltLiteral.jjtAccept(ASTJxltLiteral.java:54)
>     at 
> org.apache.commons.jexl3.internal.Interpreter.executeAssign(Interpreter.java:1558)
>     at 
> org.apache.commons.jexl3.internal.Interpreter.visit(Interpreter.java:1319)
>     at 
> org.apache.commons.jexl3.parser.ASTAssignment.jjtAccept(ASTAssignment.java:19)
>     at 
> org.apache.commons.jexl3.internal.Interpreter.visitBlock(Interpreter.java:615)
>     at 
> org.apache.commons.jexl3.internal.Interpreter.visit(Interpreter.java:594)
>     at org.apache.commons.jexl3.parser.ASTBlock.jjtAccept(ASTBlock.java:35)
>     at 
> org.apache.commons.jexl3.internal.Interpreter.forIterator(Interpreter.java:700)
>     at 
> org.apache.commons.jexl3.internal.Interpreter.visit(Interpreter.java:639) 
> {code}
> Thanks!
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to