java.lang.IllegalArgumentException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I18N Currency Formatting Issue
    via by John Piekos,
  • Issue {code} I currently have a problem concerning Camel Bindy. I have a csv file that should be parsed with Camel Bindy using a given model class. This csv file contains a number that should be parsed as a BigDecimal. The problem is that this number contains a comma as a grouping separator and a point as the decimal separator. If I start the camel route the unmarshal process will throw a NumberFormatException mentioning the invalid format of that number. So I tried to add a pattern to the DataField annotation, but the error stays. After digging throw the documentation (http://camel.apache.org/bindy.html) and the source code of FormatFactory (http://grepcode.com/file_/repo1.maven.org/maven2/org.apache.camel/camel-bindy/2.13.1/org/apache/camel/dataformat/bindy/FormatFactory.java/?v=source) I'm a little bit confused, because the documentation mentions the ability to specify a grouping separator, but the source code shows that the pattern is ignored for BigDecimal data types. Does anyone know how to specify that grouping separator? Or is this not implemented yet? {code} Solution {code} public void parsePattern(String formattedString, Locale locale, String pattern, char groupingSeparator, char decimalSeparator) throws ParseException { DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale); symbols.setGroupingSeparator(groupingSeparator); symbols.setDecimalSeparator(decimalSeparator); DecimalFormat decimalFormat = new DecimalFormat(pattern, symbols); decimalFormat.setParseBigDecimal(true); // parse the string BigDecimal bigDecimal = (BigDecimal) decimalFormat.parse(formattedString); bigDecimal.setScale(precision); System.out.println(bigDecimal); } {code}
    via by Charles Moulliard,
  • When calling setLocale(Locale locale) on a Decimalbox directly followed by setValue(BigDecimal value), the formatNumber(Object value, String defaultFormat)-method will be called, throwing a java.lang.IllegalArgumentException due to a malformed pattern. You can reproduce this behaviour with the attached files (change package in TestComposer and zul to environment ;)). Also setting the format manually will NOT solve this problem (as one might suppose). Problem is, that when setting the value right after the locale, formatNumber will be called, which usually, it isn't. Exception thrown: java.lang.IllegalArgumentException: Malformed pattern "##,##0.##" at java.text.DecimalFormat.applyPattern(Unknown Source) at java.text.DecimalFormat.applyLocalizedPattern(Unknown Source) at org.zkoss.zul.impl.NumberInputElement.formatNumber(NumberInputElement.java:219) at org.zkoss.zul.Decimalbox.coerceToString(Decimalbox.java:164) at org.zkoss.zul.impl.InputElement.renderProperties(InputElement.java:838) at org.zkoss.zul.impl.FormatInputElement.renderProperties(FormatInputElement.java:52) at org.zkoss.zul.impl.NumberInputElement.renderProperties(NumberInputElement.java:172) at org.zkoss.zul.Decimalbox.renderProperties(Decimalbox.java:174) at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:1807) at org.zkoss.zk.ui.AbstractComponent.redrawChildren(AbstractComponent.java:1884) at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:1826) at org.zkoss.zk.ui.AbstractComponent.redrawChildren(AbstractComponent.java:1884) at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:1826) at org.zkoss.zk.ui.sys.HtmlPageRenders.outPageContent(HtmlPageRenders.java:610) at org.zkoss.zul.impl.PageRenderer.renderDesktop(PageRenderer.java:104) at org.zkoss.zul.impl.PageRenderer.render(PageRenderer.java:56) at org.zkoss.zk.ui.impl.PageImpl.redraw(PageImpl.java:856) at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:490) at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:316) at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:214) at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:135) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
    via by pscheipl,
  • h3. Reproducible Case The following code works in 6.0.2 but fails in 6.5.0. Originally reported on forum http://www.zkoss.org/forum/listComment/19974 {code:xml} <decimalbox class="currency" width="200px" value="15000" locale="de" format="#,##0.00" ></decimalbox> {code} h3. Error Message The error message showed under 6.5.0 is: {code:java} Malformed pattern "#,##0.00" Caused by: java.lang.IllegalArgumentException: Malformed pattern "#,##0.00" at java.text.DecimalFormat.applyPattern(DecimalFormat.java:2561) at java.text.DecimalFormat.applyLocalizedPattern(DecimalFormat.java:2283) at org.zkoss.zul.impl.NumberInputElement.formatNumber(NumberInputElement.java:219) at org.zkoss.zul.Decimalbox.coerceToString(Decimalbox.java:164) at org.zkoss.zul.impl.InputElement.renderProperties(InputElement.java:838) at org.zkoss.zul.impl.FormatInputElement.renderProperties(FormatInputElement.java:52) at org.zkoss.zul.impl.NumberInputElement.renderProperties(NumberInputElement.java:172) at org.zkoss.zul.Decimalbox.renderProperties(Decimalbox.java:174) at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:1805) at org.zkoss.zk.ui.sys.HtmlPageRenders.outPageContent(HtmlPageRenders.java:609) at org.zkoss.zul.impl.PageRenderer.renderDesktop(PageRenderer.java:98) at org.zkoss.zul.impl.PageRenderer.render(PageRenderer.java:56) at org.zkoss.zk.ui.impl.PageImpl.redraw(PageImpl.java:854) at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:490) at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:316) at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:215) at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:135) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) {code}
    via by hawk,
  • FORMAT NUMBER TO 1.000,000
    via by 690781,
  • When calling setLocale(Locale locale) on a Decimalbox directly followed by setValue(BigDecimal value), the formatNumber(Object value, String defaultFormat)-method will be called, throwing a java.lang.IllegalArgumentException due to a malformed pattern. You can reproduce this behaviour with the attached files (change package in TestComposer and zul to environment ;)). Also setting the format manually will NOT solve this problem (as one might suppose). Problem is, that when setting the value right after the locale, formatNumber will be called, which usually, it isn't. Exception thrown: java.lang.IllegalArgumentException: Malformed pattern "##,##0.##" at java.text.DecimalFormat.applyPattern(Unknown Source) at java.text.DecimalFormat.applyLocalizedPattern(Unknown Source) at org.zkoss.zul.impl.NumberInputElement.formatNumber(NumberInputElement.java:219) at org.zkoss.zul.Decimalbox.coerceToString(Decimalbox.java:164) at org.zkoss.zul.impl.InputElement.renderProperties(InputElement.java:838) at org.zkoss.zul.impl.FormatInputElement.renderProperties(FormatInputElement.java:52) at org.zkoss.zul.impl.NumberInputElement.renderProperties(NumberInputElement.java:172) at org.zkoss.zul.Decimalbox.renderProperties(Decimalbox.java:174) at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:1807) at org.zkoss.zk.ui.AbstractComponent.redrawChildren(AbstractComponent.java:1884) at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:1826) at org.zkoss.zk.ui.AbstractComponent.redrawChildren(AbstractComponent.java:1884) at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:1826) at org.zkoss.zk.ui.sys.HtmlPageRenders.outPageContent(HtmlPageRenders.java:610) at org.zkoss.zul.impl.PageRenderer.renderDesktop(PageRenderer.java:104) at org.zkoss.zul.impl.PageRenderer.render(PageRenderer.java:56) at org.zkoss.zk.ui.impl.PageImpl.redraw(PageImpl.java:856) at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:490) at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:316) at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:214) at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:135) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
    via by pscheipl,
  • Eliminar los centavos.
    via openbravopos by cemolina
    ,
    • java.lang.IllegalArgumentException: Multiple decimal separators in pattern "SFr.#,##0.00" at java.text.DecimalFormat.applyPattern(Unknown Source) at java.text.DecimalFormat.applyPattern(Unknown Source)
    No Bugmate found.