a cell format of 3 semicolons causes an IndexOutOfBoundsException

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Normal
    • None
    • Affects Version/s: 5.12.2, 6.1.0
    • Component/s: None
    • None

      Steps to Reproduce

      1. import keikai-820.xlsx

      Current Result

      java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
      	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
      	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
      	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
      	at java.base/java.util.Objects.checkIndex(Objects.java:372)
      	at java.base/java.util.ArrayList.get(ArrayList.java:459)
      	at org.zkoss.poi.ss.format.CellFormat.<init>(CellFormat.java:229)
      	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:997)
      	at io.keikai.ui.SpreadsheetCtrlImpl.getCellAttr(SpreadsheetCtrlImpl.java:543)
      	at io.keikai.ui.SpreadsheetCtrlImpl.getRangeAttrs(SpreadsheetCtrlImpl.java:390)
      	at io.keikai.ui.Spreadsheet.createActiveRange(Spreadsheet.java:2040)
      	at io.keikai.ui.Spreadsheet.renderProperties(Spreadsheet.java:1980)
      

      Expected Result

      no error

      Debug Information

      • the cell has a special format: ;;;
      • obvious root cause
                case 4:
                default:
                    posNumFmt = parts.get(0);
                    negNumFmt = parts.get(1);
                    zeroNumFmt = parts.get(2);
                    textFmt = parts.get(3);
                    textFmt.setSectionFourTextFormat(true);// KEIKAI-243
                    break;
                }
        

      Workaround


      Use case

      This special format might have its special purposes:

      • Data Management : you may want to keep certain data hidden from view while still retaining it for calculations or further processing.
      • Error Handling : It can also be applied to cells that might produce errors (like ) to prevent those errors from displaying #VALUE!

            Assignee:
            Unassigned
            Reporter:
            hawk
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: