Uploaded image for project: 'Keikai'
  1. Keikai
  2. KEIKAI-465

the leading space characters in data number format causes IllegalArgumentException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Later Later
    • 5.10.0
    • 5.7.0
    • None
    • Security Level: Jimmy
    • None
    • None

      Steps to Reproduce

      1. load a blank sheet
      2. set data format with " [RED] -##,###,##0.00" at A1
      (there is a leading space character in the data format)
      3. type 123 at A1

      Current Result

      WARNING: Invalid format: " [RED] -##,###,##0.00"
      java.lang.IllegalArgumentException: Illegal pattern character 'R'
      at java.base/java.text.SimpleDateFormat.compile(SimpleDateFormat.java:845)
      at java.base/java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:653)
      at java.base/java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:624)
      at org.zkoss.poi.ss.format.CellDateFormatter.<init>(CellDateFormatter.java:183)
      at org.zkoss.poi.ss.format.CellFormatType$3.formatter(CellFormatType.java:53)
      at org.zkoss.poi.ss.format.CellFormatPart.getFormatter(CellFormatPart.java:381)
      at org.zkoss.poi.ss.format.CellFormatPart.<init>(CellFormatPart.java:206)
      at org.zkoss.poi.ss.format.CellFormat.<init>(CellFormat.java:196)
      at org.zkoss.poi.ss.format.CellFormat.getInstance(CellFormat.java:172)
      at io.keikai.model.impl.sys.FormatEngineImpl.getCellFormat(FormatEngineImpl.java:79)
      at io.keikaiex.model.sys.FormatEngineEx.getCellFormat(FormatEngineEx.java:46)
      at io.keikai.model.impl.sys.FormatEngineImpl.format0(FormatEngineImpl.java:98)
      at io.keikai.model.impl.sys.FormatEngineImpl.format(FormatEngineImpl.java:70)
      at io.keikai.ui.impl.CellFormatHelper.getFormatResult(CellFormatHelper.java:1020)
      at io.keikai.ui.SpreadsheetCtrlImpl.getCellAttr(SpreadsheetCtrlImpl.java:535)
      at io.keikai.ui.SpreadsheetCtrlImpl.getRangeAttrs(SpreadsheetCtrlImpl.java:382)
      at io.keikai.ui.Spreadsheet.responseUpdateCell(Spreadsheet.java:2514)
      at io.keikai.ui.Spreadsheet.updateCell(Spreadsheet.java:2479)
      at io.keikai.ui.InnerModelEventDispatcher.onCellContentChange(InnerModelEventDispatcher.java:228)
      at io.keikai.ui.ModelEventDispatcher.onEvent(ModelEventDispatcher.java:45)
      at io.keikai.model.impl.EventQueueListenerAdaptor$WrappedListener.onEvent(EventQueueListenerAdaptor.java:106)
      at org.zkoss.zk.ui.event.impl.DesktopEventQueue$QueueListener.onEvent(DesktopEventQueue.java:168)
      at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:3184)
      at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3154)
      at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3096)
      at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138)
      at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1890)
      at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1662)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1329)
      at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:611)
      at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:487)

      Expected Result

      • show red -123.00
      • keikai should trim the leading space characters like Excel

      Debug Information

      • if I set the format without the leading white space like [RED] -##,###,##0.00, no error happens.

      Workaround

      remove the space characters

            jumperchen jumperchen
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: