JavaMoney / jsr354-api

JSR 354 - Money and Currency API
http://javamoney.org
Apache License 2.0
357 stars 79 forks source link

Currency query returns null for empty results although javadoc states it does not #126

Closed hoesler closed 4 years ago

hoesler commented 4 years ago

MonetaryCurrenciesSingletonSpi#getCurrency(CurrencyQuery query) returns null if the currency query did not find any match. The javadoc for the retuned value, however, promises something different: the {@link javax.money.CurrencyUnit} found, never null.. The method should probably throw a UnknownCurrencyException instead as all other MonetaryCurrenciesSingletonSpi#getCurrency methods.

https://github.com/JavaMoney/jsr354-api/blob/8816b273928b9433880569fe0d67dd92cb1c76e0/src/main/java/javax/money/spi/MonetaryCurrenciesSingletonSpi.java#L171-L173

vincenthsin commented 4 years ago

@keilw I'll fix it. But I think it should throw MonetaryException and report not found rather than UnknownCurrencyException. By the way , I've already a JCP member under your suggestion.

keilw commented 4 years ago

Seems fixed.