Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1518

Decimalbox throws error when setting Locale and value together

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.5.2
    • 6.5.1
    • Components
    • Ubuntu 12.04 (build 144678) , Chromium 20.0.1132.47, ZK 6.5.1 built through maven on embedded tomcat 7. I will attach the pom-file so you can rebuild the exact version.

      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)

        1. TestComposer.java
          0.5 kB
        2. test.zul
          0.1 kB

            vincentjian vincentjian
            pscheipl pscheipl
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: