You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Matthew Young (JIRA)" <ji...@apache.org> on 2008/04/08 06:23:24 UTC

[jira] Created: (WICKET-1494) IntegerConvert cannot handle locale specific input/output

IntegerConvert cannot handle locale specific input/output
---------------------------------------------------------

                 Key: WICKET-1494
                 URL: https://issues.apache.org/jira/browse/WICKET-1494
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.3
            Reporter: Matthew Young


IntegerConverter, and possibly anything extends AbstractIntegerConverter cannot parse locale formatted input or output locale formatted string.  E.g., IntegerConverter.convertToObject("999,999",  new Locale("us")) raise parseexception.  IntegerConverter.convertToString(new Integer("999999", new Locale("us"))  => "999999" instead of "999,999".

This is because in AbstractIntegerConverter:

	public NumberFormat getNumberFormat(Locale locale)
	{
		NumberFormat numberFormat = (NumberFormat)numberFormats.get(locale);
		if (numberFormat == null)
		{
			numberFormat = NumberFormat.getIntegerInstance(locale);
			numberFormat.setParseIntegerOnly(true);
			numberFormat.setGroupingUsed(false);     <<<<<<<<<<<<<<<<<<<<<<<<<<  this is the problem
			numberFormats.put(locale, numberFormat);
		}
		return (NumberFormat)numberFormat.clone();
	}

Is it possible to remove "numberFormat.setGroupingUsed(false);"?

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


[jira] Closed: (WICKET-1494) IntegerConvert cannot handle locale specific input/output

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Compagner closed WICKET-1494.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3.5

the problem is that then others are not happy anymore: WICKET-1421

and i dont think i want by default grouping enabled because that is most of the time just plain ugly that you get 1.000 or 1,000 if you just want to print 1000

so what i did was lift the final of all the converters we have so you can override getNumberFormat(Locale) on it and do what ever you want.



> IntegerConvert cannot handle locale specific input/output
> ---------------------------------------------------------
>
>                 Key: WICKET-1494
>                 URL: https://issues.apache.org/jira/browse/WICKET-1494
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.3
>            Reporter: Matthew Young
>             Fix For: 1.3.5
>
>
> IntegerConverter, and possibly anything extends AbstractIntegerConverter cannot parse locale formatted input or output locale formatted string.  E.g., IntegerConverter.convertToObject("999,999",  new Locale("us")) raise parseexception.  IntegerConverter.convertToString(new Integer("999999", new Locale("us"))  => "999999" instead of "999,999".
> This is because in AbstractIntegerConverter:
> 	public NumberFormat getNumberFormat(Locale locale)
> 	{
> 		NumberFormat numberFormat = (NumberFormat)numberFormats.get(locale);
> 		if (numberFormat == null)
> 		{
> 			numberFormat = NumberFormat.getIntegerInstance(locale);
> 			numberFormat.setParseIntegerOnly(true);
> 			numberFormat.setGroupingUsed(false);     <<<<<<<<<<<<<<<<<<<<<<<<<<  this is the problem
> 			numberFormats.put(locale, numberFormat);
> 		}
> 		return (NumberFormat)numberFormat.clone();
> 	}
> Is it possible to remove "numberFormat.setGroupingUsed(false);"?

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