Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6609374

Pattern not correctly resolved by DecimalFormat(String pattern) for Nepali

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • core-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.5.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
      Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      Format recognized by both DecimalFormat and NumberFormat works correctly for most of locales. Where the group length is constant. For example : xxx,xxx,xxx.xx

      In Nepali numeric system such grouping is done

      XX,XX,XXX.XXX

      Last integer is grouped with length 3 and others with length 2.
      12,12,123.00.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      package a;

      import java.text.DecimalFormat;

      public class ABCD {
          public static void main(String[] args) {
              DecimalFormat decimalFormat = new DecimalFormat("##,##,###.##");
              String myString = decimalFormat.format(1111111111.1111d);
              System.out.println("Real : " + myString);
              System.out.println("Expected : " + "1,11,11,11,111.11");
          }
      }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      1,11,11,11,111.11
      ACTUAL -
      1,111,111,111.11

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Ref: Steps to Reproduce
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Parsing the number manually.

            peytoia Yuka Kamiya (Inactive)
            okutsu Masayoshi Okutsu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: