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

currency.properties doesn't supersede for NOK currency code

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      According to the java.util.Currency API: Users can supersede the Java runtime currency data by creating a properties file named <JAVA_HOME>/lib/currency.properties.
      currency.properties supersede doesn't work for NOK (Norwegian krone) currency code.
      It's not possible, for example, to change to 0 the default fraction digits for the NOK currency code through the currency.properties:
      NO=NOK,578,0


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create currency.properties file that looks like this:
      NO=NOK,578,0


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The default fraction digits for the NOK currency should change to 0
      ACTUAL -
      Getting an exception:
      Exception in thread "main" java.lang.IllegalArgumentException
      at java.util.Currency.getInstance(Currency.java:345)
      at java.util.Currency.getInstance(Currency.java:310)
      at test.testCurrency.main(testCurrency.java:9)


      ---------- BEGIN SOURCE ----------
      import java.util.Currency;

      public class testCurrency {

      public static void main(String[] args) {
      Currency curr = Currency.getInstance("NOK");
      System.out.println(curr.getDefaultFractionDigits());
      }

      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: