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

Currency becomes XXX if do not specify user.country.format

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 7
    • 7
    • core-libs
    • b118
    • generic
    • generic
    • Verified

      When I kick following code with specifying user.language.display and
      user.language.format, the output currency becomes "XXX".

      public class decimalFormatTest {
        public static void main(String[] args) {
          DecimalFormat decif = new DecimalFormat();
          System.out.println(decif.getCurrency());
        }
      }

      % java -Duser.language.format=ja -Duser.language.display=fr decimalFormatTest
      Currency = XXX

      Then, if specify the user.country.format, output become correct one

      % java -Duser.language.format=ja -Duser.language.display=fr -Duser.country.format=FR decimalFormatTest
      Currency = EUR

      But will not be correct when specify user.country.display only.

      % java -Duser.language.format=ja -Duser.language.display=fr -Duser.country.display=FR decimalFormatTest
      Currency = XXX

      Then, if specifying user.language.display and user.country.display, seems that OS default is used.

      % java -Duser.language.display=fr -Duser.country.display=FR decimalFormatTest
      Currency = JPY


      Also, NumberFormat.getCurrencyInstance() will work the same way as DecimalFormat.getCurrency().

            naoto Naoto Sato
            ktachiba Kenji Tachibana
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: