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

Currency pattern for Brazil incorrect

    Details

    • Subcomponent:
    • Resolved In Build:
      mantis
    • CPU:
      x86
    • OS:
      windows_xp
    • Verification:
      Verified

      Description



      Name: jl125535 Date: 03/12/2002


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


      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows XP [Version 5.1.2600]
      Reproduced on Solaris 8 with JDK 1.4.


      A DESCRIPTION OF THE PROBLEM :
      Here in Brazil we use two decimal places for currency
      (#.##0,00), but the pattern returned by
      getCurrencyInstance is #.##0,## - which ignores zeros
      after the decimal.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Currency pattern expected for Brazil is "R$ #.##0,00".
      It is currently returning "R$ #.##0,##".


      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.text.DecimalFormat;
      import java.text.NumberFormat;
      import java.util.Locale;

      class CurrencyTest {

          public static void main (String argv[] ) {
              String expectedCurrencyPattern = "\u00A4 #.##0,00";
          
              Locale locale = new Locale ("pt", "BR");
              Locale.setDefault(locale);
          
              DecimalFormat formatter =
                  (DecimalFormat) NumberFormat.getCurrencyInstance(locale);

              if (formatter.toLocalizedPattern().equals(expectedCurrencyPattern)) {
                  System.out.println ("Passed.");
              } else {
                   System.out.println ("Failed Currency pattern." +
                          " Expected: " + expectedCurrencyPattern +
                          " Received: " + formatter.toLocalizedPattern() );
              }
          }
      }


      ---------- END SOURCE ----------
      (Review ID: 143998)
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              kcolfersunw Kieran Colfer (Inactive)
              Reporter:
              jleesunw Jon Lee (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: