Let Currency.getInstance(Locale) always throw NPE for country==null.
This makes the code slightly more similar to OpenJDK 8u121-b13.
This should not affect apps:
1.) ICU.getCurrencyCode(null) already throws NPE, so in most
cases the behavior has not changed:
java.lang.NullPointerException
at libcore.icu.ICU.getCurrencyCode(Native Method)
2.) It's not reasonable for apps to rely on the special case
(variant among {EURO,HK,PREEURO}).
3.) There doesn't seem to be a straightforward way to construct
a Locale with country == null.
Test: Empirically checked that ICU.getCurrencyCode(null) throws NPE.
Test: LocaleTest.test_nullCountry_fails() passes when run on devices
that run code both before and after this CL.
Bug: 35910877
Change-Id: I11c9b4c038229320b417c4309ebe43b3cc621653
Loading
Please sign in to comment