Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bkolarov opened this issue Oct 28, 2021 · 0 comments
Open

Comments

@bkolarov
Copy link

bkolarov commented Oct 28, 2021

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.

@bkolarov bkolarov changed the title CountryCodes.EU.getCurrency() crashes on newer versions of Java CountryCodes.EU.getCurrency() returns null on newer versions of Java Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant