DoubleConverter / NumberCFType is not as I18N as it could / should be - decimal separator does not respect user's locale

XMLWordPrintable

      The current implementation of DoubleConverter hard codes a decimal separator of period '.'

      This doesnt work in locations that use comma ',' as the decimal separator.

      We should not hard code the call to setDecimalSeparator especially for the display format.

      public class DoubleConverter
      {
          private static final DecimalFormat DISPLAY_FORMAT;
          static
          {
              DISPLAY_FORMAT = new DecimalFormat();
              DISPLAY_FORMAT.setGroupingUsed(false);
              DISPLAY_FORMAT.setMinimumFractionDigits(0);
              DecimalFormatSymbols formatSymbols = new DecimalFormatSymbols();
              formatSymbols.setDecimalSeparator('.');
              DISPLAY_FORMAT.setDecimalFormatSymbols(formatSymbols);
          }
      
          private static final DecimalFormat LUCENE_FORMAT;
          static
          {
              LUCENE_FORMAT = new DecimalFormat();
              LUCENE_FORMAT.setGroupingUsed(false);
              LUCENE_FORMAT.setMinimumIntegerDigits(14);
              LUCENE_FORMAT.setMaximumIntegerDigits(14);
              LUCENE_FORMAT.setMinimumFractionDigits(3);
              LUCENE_FORMAT.setMaximumFractionDigits(3);
              DecimalFormatSymbols formatSymbols = new DecimalFormatSymbols();
              formatSymbols.setDecimalSeparator('.');
              LUCENE_FORMAT.setDecimalFormatSymbols(formatSymbols);
          }
      ...
      ...
      

            Assignee:
            Pawel Niewiadomski (Inactive)
            Reporter:
            ɹǝʞɐq pɐɹq
            Votes:
            12 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: