You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2011/08/29 18:32:38 UTC

[jira] [Commented] (MYFACES-3195) NumberConverter ignores groupingUsed attribute when parsing

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

Leonardo Uribe commented on MYFACES-3195:
-----------------------------------------

Could you provide an example when groupingUsed should be used when parsing? Obviously the previous example is expected, but it is necessary to find another example where this could be a problem to fix it.

> NumberConverter ignores groupingUsed attribute when parsing
> -----------------------------------------------------------
>
>                 Key: MYFACES-3195
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3195
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 2.0.7
>         Environment: Linux, Tomcat, Spring, Hibernate, ... (please ask for more details)
>            Reporter: Bastian Voigt
>            Assignee: Leonardo Uribe
>
> javax.faces.convert.NumberConverter uses the "groupingUsed" attribute only for formatting, but not for parsing numbers. This leads to a nasty bug:
> When I input the value "0.23" in an input field using a German locale, it is converted to "23.00", which is bad.
> Proposed patch, in method getAsObject():
>                 NumberFormat format = getNumberFormat(facesContext);
>                 format.setParseIntegerOnly(_integerOnly);
> +              format.setGroupingUsed(_groupingUsed);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira