[ 
https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42764
 ] 

smittel edited comment on WW-2349 at 12/4/07 1:39 AM:
--------------------------------------------------------

Ok I think have found the cause of this issue. Some XWork developer disabled 
the localization for Number to String conversion in 
com.opensymphony.xwork2.util.XWorkBasicConverter, line 76:

<snip>
        if (toType == String.class) {
            /* the code below has been disabled as it causes sideffects in 
Strtus2 (XW-512)
            // if input (value) is a number then use special conversion method 
(XW-490)
            Class inputType = value.getClass();
            if (Number.class.isAssignableFrom(inputType)) {
                result = doConvertFromNumberToString(context, value, inputType);
                if (result != null) {
                    return result;
                }
            }*/
            // okay use default string conversion
            result = doConvertToString(context, value);
</snip>

Well, it seems that disabling this code also has serious side effects, as it 
causes the mentioned problem when using a non-English locale.

      was (Author: smittel):
    Ok maybe I have found the cause of this issue. Some developer disabled the 
localization for Number to String conversion in 
com.opensymphony.xwork2.util.XWorkBasicConverter, line 76:

<snip>
        if (toType == String.class) {
            /* the code below has been disabled as it causes sideffects in 
Strtus2 (XW-512)
            // if input (value) is a number then use special conversion method 
(XW-490)
            Class inputType = value.getClass();
            if (Number.class.isAssignableFrom(inputType)) {
                result = doConvertFromNumberToString(context, value, inputType);
                if (result != null) {
                    return result;
                }
            }*/
            // okay use default string conversion
            result = doConvertToString(context, value);
</snip>

Well, it seems that disabling this code also has serious side effects, as it 
causes the mentioned problem when using a non-English locale.
  
> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Priority: Blocker
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for 
> this property. It only accepts a "," (comma) as a decimal separator due to 
> the set locale.
> But when the Double property is preset to a certain value and the page 
> rendered afterwards, the textfield is filled with a number using the "." 
> (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is 
> inconsistent.

-- 
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