error in doubleconverter
------------------------

                 Key: TRINIDAD-1360
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1360
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Components
    Affects Versions: 1.0.10-core, 1.2.10-core
            Reporter: Gabrielle Crawford


Doubleconverter ignores locale, so it just does this on the server

* getAsString() --> return Double.toString(((Number)value).doubleValue());
* getAsObject() --> return Double.valueOf(stringValue);

On the client it does something similar to the server for getAsString. 

However on the client for getAsObject it's calling _decimalParse, which uses 
localeSymbols to parse, which means it's using locale specific formatting on 
the client to interpret the string to an object. The doubleconverter must be 
consistent, either it's using the locale to parse/format to/from a string on 
both the server and client, or it's not, but the hybrid approach it's using 
right now causes bugs.

If I change my language to German [de] and run this
     <af:inputText label="value"
               value="#{demoInputNumberSlider.numberValue}"/>

and then type in "4.5" and tab out, it's turning this into 45 in _decimalParse. 

If I type in "4,5" it's interpreting this as 4.5 on the client and not showing 
an error. However the string '4,5' will cause an error on the server, and 
should therefore cause an error on the client.

So, if I have this, and I enter 4.5 it tells me I have an error, because it 
thinks the value is 45 and not 4.5!
 <tr:inputText value="#{clientValidation.double}" label="double converter">
                <tr:validateDoubleRange maximum="10.5" minimum="1.5"/>
              </tr:inputText>



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to