1

The issue is for an application built on Java Platform. While subscribing to a JMS message from other Application, the message fails with the following exception

Caused by: java.lang.IllegalArgumentException
at java.util.Currency.getInstance(Currency.java:320)
at java.util.Currency.getInstance(Currency.java:284)

The exception is coming from Java Util. Going a step further java.util.currency supports ISO 4217 currency codes. (https://www.iso.org/iso-4217-currency-codes.html to get the valid currencies as per ISO 4217). Now CNH is not a valid currency as per ISO 4217 standards.

PRC released CNH for trading Chinese currency outside China. This a valid requirement

Can the Java experts provide for any workaround for this issue

Regards,

Sameer

Michael
  • 41,989
  • 11
  • 82
  • 128
Sameer
  • 21
  • 1
  • 2
  • A quick search showed that ISO 4217 listed Renminbi as `CNY` (China Yuan Renminbi). Why do you need `CNH` when there is already some kind of valid currency code for Renminbi? – Jai Jun 04 '18 at 09:21
  • 1
    @Jai CNH and CNY trade at different rates in different markets so can effectively be considered as distinct currencies. See [*CNY vs CNH Rates: What’s the difference?*](https://blog.sendwyre.com/cny-vs-cnh-rates-whats-the-difference-901a23aa0a40) – Michael Jun 04 '18 at 09:25
  • It still doesn’t make CNH a ISO 4217 currency code. Although the duplicate explains how to hack CNH into the data file, a better solution is to make your own class (that can link to java.util.Currency for official ISO codes but have a null reference for unofficial ones). There are more codes used in trading that are not official and a typical trading system needs to store more information for a currency in any case, so the choice for a new domain class is easy. – Erwin Bolwidt Jun 04 '18 at 09:59
  • Thanks a lot all for an exciting discussion and thoughts. I was told by customer who is a retailer that they need to pay the supplier in China in CNH and not CNY. – Sameer Jun 04 '18 at 10:18

0 Answers0