myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <>
Subject [jira] [Commented] (MYFACES-3195) NumberConverter ignores groupingUsed attribute when parsing
Date Thu, 01 Sep 2011 04:29:10 GMT


Leonardo Uribe commented on MYFACES-3195:

I tried this junit test (just adding it to NumberConverterTest):

    public void testEnglishLocale()
        UIInput input = new UIInput();
        Number testValue = 4096.23d;
        String stringValue = mock.getAsString(facesContext, input, testValue);
        Number number = (Number) mock.getAsObject(facesContext, input, stringValue);
        assertEquals(testValue, number);

It is just the same as you are doing. I debugged step by step and it works without do any
change. Unfortunately any attempt done to reproduce this issue just fails. Why? no idea. Probably
there is something related to your jvm. The only similar description found at this moment

Which jvm version are you using? is sun jvm? jrockit? harmony?

> NumberConverter ignores groupingUsed attribute when parsing
> -----------------------------------------------------------
>                 Key: MYFACES-3195
>                 URL:
>             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:


View raw message