TakahikoKawasaki/nv-i18n

CountryCodes.EU.getCurrency() returns null on newer versions of Java

Opened this issue · 0 comments

The getCurrency() method in com.neovisionaries.i18n.CountryCode fails for CountryCode.EU. The currency cannot be resolved for the locale Locale("", "EU") and an exception gets thrown by the standard library.

import java.util.*;

class Main {

    public static void main(String[] args) {
        var l = new Locale("", "EU");
        var c = Currency.getInstance(l);

        println(c);
    }

}
Exception in thread "main" java.lang.IllegalArgumentException
        at java.base/java.util.Currency.getInstance(Currency.java:410)
        at Main.main(currency.java:7)

Due to the exception handling, the call CurrencyCode.EU.getCurrency() results with null.