Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnknownCurrencyException: Unknown currency code: XXX #417

Open
SamuelPavlik opened this issue Jul 1, 2024 · 0 comments
Open

UnknownCurrencyException: Unknown currency code: XXX #417

SamuelPavlik opened this issue Jul 1, 2024 · 0 comments

Comments

@SamuelPavlik
Copy link

SamuelPavlik commented Jul 1, 2024

I am using Kotlin and Moneta 1.4, and have them included in my classpath :

  • moneta-core-1.4.4.jar
  • money-api-1.1.jar

In my application I have the following code:

fun doSomething(paymentFee: Double, currency: String) {
    val paymentFee: MonetaryAmount = FastMoney.of(paymentFee, currency),
}

When calling the code in one of the environments that I'm using, I'm consistently getting the following error:

"exception": "java.lang.ExceptionInInitializerError: Exception javax.money.UnknownCurrencyException: Unknown currency code: XXX [in thread \"Thread-572\"]
        at javax.money.spi.MonetaryCurrenciesSingletonSpi.getCurrency(MonetaryCurrenciesSingletonSpi.java:78)
        at javax.money.Monetary.getCurrency(Monetary.java:382)\n\tat org.javamoney.moneta.FastMoney.<clinit>(FastMoney.java:119)

I checked the data and there's no XXX when FastMoney.of() is getting called. Since it's ExceptionInInitializerError (error during static initialization) I presume it's caused by this line in the FastMoney class:

public static final FastMoney MAX_VALUE = new FastMoney(Long.MAX_VALUE, Monetary.getCurrency("XXX"));

However, I don't know why this error only occurs in that one environment, and how to fix it.

Thanks for any help in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant