java.lang.IllegalArgumentException: Multiple decimal separators in pattern "SFr.#,##0.00"

Coderanch | John Piekos | 1 decade ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I18N Currency Formatting Issue

    Coderanch | 1 decade ago | John Piekos
    java.lang.IllegalArgumentException: Multiple decimal separators in pattern "SFr.#,##0.00"
  2. 0

    Error in loading Exceptions panel | Oracle Community

    oracle.com | 1 year ago
    java.lang.IllegalArgumentException: Malformed pattern "#.##0"
  3. 0

    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}

    Apache's JIRA Issue Tracker | 3 years ago | Charles Moulliard
    java.lang.IllegalArgumentException: Malformed pattern "###.##0,00"
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    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)

    ZK-Tracker | 4 years ago | pscheipl
    java.lang.IllegalArgumentException: Malformed pattern "##,##0.##"
  6. 0

    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}

    ZK-Tracker | 4 years ago | hawk
    java.lang.IllegalArgumentException: Malformed pattern "#,##0.00"

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Multiple decimal separators in pattern "SFr.#,##0.00"

      at java.text.DecimalFormat.applyPattern()
    2. Java RT
      DecimalFormat.applyPattern
      1. java.text.DecimalFormat.applyPattern(Unknown Source)
      2. java.text.DecimalFormat.applyPattern(Unknown Source)
      2 frames