-
Notifications
You must be signed in to change notification settings - Fork 40
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
Formatting using SYMBOL throws an exception #25
Comments
Which version of the JSR/Moneta did you use to reproduce that? |
With both 1.0.1-SNAPSHOT as well as 1.0. |
Thanks, that indicates, it wasn't already fixed in master/1.0.1-SNAPSHOT. |
Ok, great. Thank you for the update. |
Any update on this? Is this a problem the Moneta implementation? |
I ran this code, and it's fine. DecimalFormatSymbols symbols = new DecimalFormatSymbols();
MonetaryAmountFormat fmt =
MonetaryFormats.getAmountFormat (
AmountFormatQueryBuilder.of(Locale.US)
.set(symbols)
.build ());
CurrencyUnit currencyUnit = Monetary.getCurrency(Locale.US);
System.out.println(fmt.format(Money.of(10, currencyUnit))); |
This appears to still be a problem. Is there any other solution? Please see my stack overflow question: http://stackoverflow.com/questions/42098171/how-to-format-monetaryamount-with-currency-symbol |
Running the FormatExample class throws an exception when we try to run the US SYMBOL code:
Nov 04, 2015 11:46:45 AM org.javamoney.moneta.DefaultMonetaryContextFactory createMonetaryContextNonNullConfig
INFO: Using custom MathContext: precision=256, roundingMode=HALF_EVEN
Exception in thread "main" javax.money.MonetaryException: No MonetaryAmountFormat for AmountFormatQuery AmountFormatQuery (
{Query.formatName=SYMBOL, java.util.Locale=en_US})
at javax.money.spi.MonetaryFormatsSingletonSpi.getAmountFormat(MonetaryFormatsSingletonSpi.java:71)
at javax.money.format.MonetaryFormats.getAmountFormat(MonetaryFormats.java:110)
at org.javamoney.examples.console.functional.FormatExample.main(FormatExample.java:24)
The text was updated successfully, but these errors were encountered: