JavaMoney / jsr354-ri

JSR 354 - Moneta: Reference Implementation
Other
344 stars 101 forks source link

UK locale fails to get the currency code #345

Closed habutre closed 4 years ago

habutre commented 4 years ago

I have identified an misbehavior when using moneta with UK instead GB. Even UK bring a valid country on java locale it fails when used to retrieve the currency code.

  public static void main(String[] args) {
    var locale = new Locale("en", "UK");
    var currency = Monetary.getCurrency(locale);
  }

results in:

Exception in thread "main" javax.money.MonetaryException: No currency unit found for locale: en_UK
    at javax.money.spi.MonetaryCurrenciesSingletonSpi.getCurrency(MonetaryCurrenciesSingletonSpi.java:97)
    at javax.money.Monetary.getCurrency(Monetary.java:401)

Shouldn't moneta returns GBP for both gb and uk?

PS:. I didn't find any issue opened or closed related to this

habutre commented 4 years ago

Using Locale.UK make it work, my bad