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

Jacques Le Roux updated OFBIZ-10019:
------------------------------------
    Description: 
I want to replace ?default(value) by !value in Freemarker templates, that's 
1394 cases!

But before doing so I prefer to wait for a 2.4 Freemarker version because we 
already experienced an issue at OFBIZ-4902, see 
http://svn.apache.org/viewvc?view=revision&revision=r1624876

Actually I know now that it was not a bug of ours but [one of 
Freemarker|https://freemarker.apache.org/docs/dgui_template_exp.html#dgui_template_exp_missing_default]:
bq. Warning! If you have a composite expression after the \!, like 1 + x, 
always use parenthesses, like ${x!(1 + y)} or ${(x!1) + y)}, depending on which 
interpretation you meant. That's needed because due to a programming mistake in 
FreeMarker 2.3.x, the precedence of ! (when it's used as default value 
operator) is very low at its right side. This means that, for example, ${x!1 + 
y} is misinterpreted by FreeMarker as ${x!(1 + y)} while it should mean ${(x!1) 
+ y}. This programming error will be fixed in FreeMarker 2.4, so you should not 
utilize this wrong behavior, or else your templates will break with FreeMarker 
2.4!


  was:
I want to teplace ?default(value) by !value in Freemarker templates, that's 
1394 cases!

But before doing so I prefer to wait for a 2.4 Freemarker version because we 
already experienced an issue at OFBIZ-4902, see 
http://svn.apache.org/viewvc?view=revision&revision=r1624876

Actually I know now that it was not a bug of ours but [one of 
Freemarker|https://freemarker.apache.org/docs/dgui_template_exp.html#dgui_template_exp_missing_default]:
bq. Warning! If you have a composite expression after the \!, like 1 + x, 
always use parenthesses, like ${x!(1 + y)} or ${(x!1) + y)}, depending on which 
interpretation you meant. That's needed because due to a programming mistake in 
FreeMarker 2.3.x, the precedence of ! (when it's used as default value 
operator) is very low at its right side. This means that, for example, ${x!1 + 
y} is misinterpreted by FreeMarker as ${x!(1 + y)} while it should mean ${(x!1) 
+ y}. This programming error will be fixed in FreeMarker 2.4, so you should not 
utilize this wrong behavior, or else your templates will break with FreeMarker 
2.4!



> Replace ?default(value) by !value in Freemarker templates
> ---------------------------------------------------------
>
>                 Key: OFBIZ-10019
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10019
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL COMPONENTS
>    Affects Versions: Trunk
>            Reporter: Jacques Le Roux
>            Assignee: Jacques Le Roux
>            Priority: Trivial
>             Fix For: Upcoming Release
>
>
> I want to replace ?default(value) by !value in Freemarker templates, that's 
> 1394 cases!
> But before doing so I prefer to wait for a 2.4 Freemarker version because we 
> already experienced an issue at OFBIZ-4902, see 
> http://svn.apache.org/viewvc?view=revision&revision=r1624876
> Actually I know now that it was not a bug of ours but [one of 
> Freemarker|https://freemarker.apache.org/docs/dgui_template_exp.html#dgui_template_exp_missing_default]:
> bq. Warning! If you have a composite expression after the \!, like 1 + x, 
> always use parenthesses, like ${x!(1 + y)} or ${(x!1) + y)}, depending on 
> which interpretation you meant. That's needed because due to a programming 
> mistake in FreeMarker 2.3.x, the precedence of ! (when it's used as default 
> value operator) is very low at its right side. This means that, for example, 
> ${x!1 + y} is misinterpreted by FreeMarker as ${x!(1 + y)} while it should 
> mean ${(x!1) + y}. This programming error will be fixed in FreeMarker 2.4, so 
> you should not utilize this wrong behavior, or else your templates will break 
> with FreeMarker 2.4!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to