[ 
https://issues.apache.org/jira/browse/FREEMARKER-227?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dániel Dékány closed FREEMARKER-227.
------------------------------------
    Assignee: Dániel Dékány

Fix was released with 2.3.34.

> ClassicCompatible setting doesn't work with sequence built-ins as expected
> --------------------------------------------------------------------------
>
>                 Key: FREEMARKER-227
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-227
>             Project: Apache Freemarker
>          Issue Type: Bug
>    Affects Versions: 2.3.30, 2.3.33
>            Reporter: Natalia Shashok
>            Assignee: Dániel Dékány
>            Priority: Major
>             Fix For: 2.3.34
>
>
> When turning classic compatible mode to true, usage of seq_contains, 
> seq_index_of, seq_last_index_of built-ins becomes unstable.
> Consider the following template:
> <#setting classic_compatible=true>
> <#if eight?seq_contains(1)> </#if>
> If the next values are passed to generate a document:
> eight=[ "2", "1", "3"]
> then generation fails with the following error:
>  
> {code:java}
> Expression has thrown an unchecked exception; see the cause exception.The 
> blamed expression:==> eight?seq_contains(1)  [in nameless template at line 2, 
> column 6]
> ----FTL stack trace ("~" means nesting-related):      - Failed at: #if 
> eight?seq_contains(1)  [in nameless template at line 2, column 1]----
> Caused by:java.lang.NullPointerException: null{code}
> After further investigation it was found out that
> 1) seq_ built-ins react badly on integers, whether the integer is actually 
> contained within the sequence or not;
> 2) seq_ built-ins work correctly on strings if the strings passed to 
> built-ins is contained within the sequence, but will fail with the same 
> NullPointerException if the string isn't contained within the sequence;
> 3) it does not matter whether the built-ins are used in conditional 
> expressions - it was tested in interpolations as well.
> This behavior was found out in versions 2.3.30 and was tested to be still 
> present in 2.3.33.
> Is there any way to mitigate these errors upon using classic_compatible mode? 
> Any help would be greatly appreciated.
>  



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

Reply via email to