Open keilw opened 3 years ago
While it's odd, the problem does not happen in every situation, e.g. in a Maven build it always does, but debugging the TestNG tests in an IDE cannot replicate it the same way.
A possible remedy could be to log a warning for such configuration case, but not throw an exception, but while the "AmbiguousConfiguration" seems fine, to scale down to a warning, the missing configuration for exchange rate providers like ECB or others must be fixed anyway.
Hi, I've looked into this and the cause seems to be this particular line; according to the ClassLoader.getResources javadoc:
this method will only find resources in packages of named modules when the package is opened unconditionally (even if the caller of this method is in the same module as the resource)
This causes all of the javamoney.properties
files inside named modules (like the one in the org.javamoney.moneta.convert.ecb
module) to be ignored, with the result that:
getExchangeRate
will fail when waiting for the load lock.I think this could be solved by, in each provider, registering a default configuration (the current one in javamoney.properties
) if the LoaderService
did not find an existing one.
Thanks, especially in case of ECB the loading fails for different reasons, at least for historic ones, but all providers (also current or HIST-90) failing tests might be addressed that way.
Unfortunately you introduced a bug, will have to comment the relevant parts out, because at least for 1.4.3 it is unlikely we'll also add Multi-Release-JARs yet and the minimal version (might raise it to 11 or 17 in 1.5) is still Java 8.
That Map.of(array)
did not exist until Java 9, that's why it fails because the classes represent the lowest JDK which is 8.
As this only seems to affect 4 JUnit tests, it can be done later.
There are build failures related to MonetaryConfig right now:
This seems to affect the ECB exchange module: