Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6655

[classlib][luni]util:currency.getInstance does not throw IllegalArgumentException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Classlib
    • None

    Description

      executing this code
      Currency c = Currency.getInstance("ABC");
      System.out.prvintln(c);

      we get ABC as output in Harmony where as on SUN ri we get IllegalArgumentException because ABC is not a supported ISO 4217 code.

      In our current design for getInstance(String currencyCode), we do not check the input currencyCode. If we use icu to check, it still doesn't work. ICU just checks if the input is a 3-letter alpha code while not to check if the input is a supported ISO 4217 code. So for ICU, "ABC" is also a valid input.

      I think there will be two ways to fix it:
      1. ask ICU to check the input.
      2. maintain a ISO 4217 code list in our implementation and to check the input by ourself.

      Attachments

        Activity

          People

            Unassigned Unassigned
            yangjiny Jin Yang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: