Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1494

IntegerConvert cannot handle locale specific input/output

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3.3
    • 1.3.5
    • wicket
    • None

    Description

      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);"?

      Attachments

        Activity

          People

            Unassigned Unassigned
            matthewyoung Matthew Young
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: