struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukasz Lenart (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (WW-4870) StringConverter from OGNL 3.1.15 in Struts 2.5.13
Date Fri, 13 Oct 2017 11:42:00 GMT

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

Lukasz Lenart edited comment on WW-4870 at 10/13/17 11:41 AM:
--------------------------------------------------------------

The case here is that there are two layers which perform conversion. First Freemarker tries
to convert a String to a number (because the String looks like a number - see the whole discussion
here WW-4837 and this [1]) and probably it uses a default locale ({{fr}}) and now it passes
the BigDecimal to the Struts tag. So now Struts/OGNL tries to convert the BigDecimal back
to the String (an expected type) and it uses defined user locale ({{fr}}) to convert a BigDecimal
to a String.

Using quotes as suggested by Yasser could help.

[1] http://freemarker.org/docs/dgui_template_exp.html#dgui_template_exp_direct_number


was (Author: lukaszlenart):
The case here is that there two layers which perform conversion. First Freemarker tries to
convert a String to a number (because the String looks like a number - see the whole discussion
here WW-4837 and this [1]) and probably it uses a default locale ({{fr}}) and now it passes
the BigDecimal to the Struts tag. So now Struts/OGNL tries to convert the BigDecimal back
to the String (an expected type) and it uses defined user locale ({{fr}}) to convert a BigDecimal
to a String.

Using quotes as suggested by Yasser could help.

[1] http://freemarker.org/docs/dgui_template_exp.html#dgui_template_exp_direct_number

> StringConverter from OGNL 3.1.15 in Struts 2.5.13
> -------------------------------------------------
>
>                 Key: WW-4870
>                 URL: https://issues.apache.org/jira/browse/WW-4870
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.5.13
>            Reporter: Amaury
>             Fix For: 2.5.14
>
>
> Hi Apache / Struts 2 team,
> We've just discovered a bug with the new version 2.5.13 of Struts 2, mainly in OGNL dependency.
This is not the case with 2.5.10.
> *Scenario*: we have a boolean method in a "if" condition statement in FTL view. This
method takes on argument which is a String ID in the format "X.Y" (ex: "1.1).
> *Result obtained during the OGNL parsing*: StringConverter is called according to the
"locale" of the browser and apparently with "fr_FR" locale, the "X.Y" is converted to decimal
format "X,Y" which is wrong since we want to stick with our ID as it arrives.
> It seems with en_US locale, the decimal conversion doesn't happen.
> *Result expected*: the ID "X.Y" goes to the "if" statement as it is, not converted in
fr_Fr locale.



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

Mime
View raw message