Romanian Currency ROL-RON Problem on Different Environments

Viewed 64

I have a currency project with Java Spring Boot and according to some datas, I'm writing the currency to the page.

Here is my currency finding code:

String currencyCode = "0946";
Optional<Currency> currency = Currency.getAvailableCurrencies().stream().filter(currency -> currency.getNumericCode() == Integer.parseInt(currencyCode)).findAny();
String currencySymbol = currency.get().getSymbol(Locale.getDefault());

I'm using openjdk:8-alpine as Java Runtime Environment. When I run this code at my test environment, I can get the RON which is correct. But my client who is in Romania, runs the application and gets ROL instead of RON.

What can be the problem about getting ROL instead of RON?

1 Answers

ROL is an obsolete currency code. RON is current. See Wikipedia: Romanian leu, History.

Either your client should update Java environment, or you should start using currency codes instead of numbers (which as you can see may change mapping).

Related