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

BigDecimalConverter does not work with space - eg, French or Russian Locales.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3.1
    • 1.3.2
    • wicket
    • None

    Description

      Space character is not getting correctly translated when converting to BigDecimal.

      The following occurs with a bound BigDecimal field

      Input: 3000
      Submit
      Output: 3 000


      Input: 3 000
      Submit
      Output: 3

      The following code highlights the problem.

      BigDecimalConverter bdc = new BigDecimalConverter();
      System.out.println(bdc.convertToObject("3 000", Locale.FRENCH));
      =>3

      DoubleConverter dc = new DoubleConverter();
      System.out.println(dc.convertToObject("3 000", Locale.FRENCH));
      =>3000.0

      I think I found the problem.

      BigDecimalConverter#convertToObject is calling getNumberFormat(locale), but it should be calling AbstractNumberConverter#parse like DoubleConverter does (or something similar).

      It looks like code to handle the different "thousand" separators has been added there.

      Also of note, it does not appear that the BigDecimalConverter is covered by the Converters test.

      See thread http://www.nabble.com/BigDecimal-converter---broken-for-French-Russian-%21--ts15820747.html for more context.

      Attachments

        Activity

          People

            jcompagner Johan Compagner
            ned.collyer Ned Collyer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: