You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currency.getCurrency() is a wrapper for java.util.Currency.getInstance(String). If the getInstance(String) returns null or throws an IllegalArgumentException, Currency.getCurrency() returns null.
$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
$ cat TestMRUCurrency.java
public class TestMRUCurrency
{
public static void main(String[] args)
{
System.out.println(java.util.Currency.getInstance("MRU"));
}
}
$ java TestMRUCurrency
Exception in thread "main" java.lang.IllegalArgumentException
at java.util.Currency.getInstance(Currency.java:345)
at java.util.Currency.getInstance(Currency.java:310)
at TestMRUCurrency.main(TestMRUCurrency.java:5)
Trying to retrieve the Currency object for MRU throws a NullPointerException.
Code to recreate issue:
Currency currency = CurrencyCode.MRU.getCurrency();
The text was updated successfully, but these errors were encountered: