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

Java.util.Currency.getSymbol(Locale) returns wrong value when locale is not US

XMLWordPrintable

      FULL PRODUCT VERSION :
      java 1.6.0_20

      ADDITIONAL OS VERSION INFORMATION :
      Ver 2002

      A DESCRIPTION OF THE PROBLEM :
      If locale is the default locale, US, then the customer "$" is returned. However, there are other locales that also have the "$" as their currency. These locales need to differentiate the American dollar using "US$". Currently, "USD" is returned.

      Currency currency = Currency.getInstance("USD");
      System.out.println(currency.getSymbol());
      System.out.println(currency.getSymbol(Locale.CANADA));
      System.out.println(currency.getSymbol(new Locale("en","AU")));
       
      in the above mentioned SOPs, the value returned is $, US$ and USD respectively.

        Fix for a previous BUG ID 6573250 was released so now it returns US$ for CANADA locale however I understand when the locale is Australia, it should also return US$ NOT USD

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Currency currency = Currency.getInstance("USD");
      System.out.println(currency.getSymbol());
      System.out.println(currency.getSymbol(Locale.CANADA));
      System.out.println(currency.getSymbol(new Locale("en","AU")));



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected:
      $
      US$
      US$

      ACTUAL -

      Actual
      $
      US$
      USD

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Currency currency = Currency.getInstance("USD");
      System.out.println(currency.getSymbol());
      System.out.println(currency.getSymbol(Locale.CANADA));
      System.out.println(currency.getSymbol(new Locale("en","AU")));
      ---------- END SOURCE ----------

            ljiang Leo Jiang (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: