https://issues.apache.org/bugzilla/show_bug.cgi?id=51273

             Bug #: 51273
           Summary: ArrayIndexOutOfBoundsException in
                    FormulaCellCacheEntrySet
           Product: POI
           Version: 3.8-dev
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [email protected]
    Classification: Unclassified


java.lang.ArrayIndexOutOfBoundsException: -2
        at
org.apache.poi.ss.formula.FormulaCellCacheEntrySet.addInternal(FormulaCellCacheEntrySet.java:83)
        at
org.apache.poi.ss.formula.FormulaCellCacheEntrySet.add(FormulaCellCacheEntrySet.java:72)
        at
org.apache.poi.ss.formula.CellCacheEntry.addConsumingCell(CellCacheEntry.java:85)
        at
org.apache.poi.ss.formula.FormulaCellCacheEntry.changeConsumingCells(FormulaCellCacheEntry.java:80)
        at
org.apache.poi.ss.formula.FormulaCellCacheEntry.setSensitiveInputCells(FormulaCellCacheEntry.java:60)
        at
org.apache.poi.ss.formula.FormulaCellCacheEntry.updateFormulaResult(FormulaCellCacheEntry.java:109)
        at
org.apache.poi.ss.formula.CellEvaluationFrame.updateFormulaResult(CellEvaluationFrame.java:75)
        at
org.apache.poi.ss.formula.EvaluationTracker.updateCacheResult(EvaluationTracker.java:94)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:286)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:221)
        at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateFormulaCellValue(HSSFFormulaEvaluator.java:320)
        at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluate(HSSFFormulaEvaluator.java:182)

Appears to occur randomly when calling HSSFFormulaEvaluator.evaluate(Cell cell)
more than once on the same cell.

Looking at the FormulaCellCacheEntrySet.java:83:

    int startIx = cce.hashCode() % arr.length;
    for(int i=startIx; i<arr.length; i++) {

startIx could be negative hence the ArrayIndexOutOfBoundsException

Workaround: call HSSFFormulaEvaluator.clearAllCachedResultValues() before
invoking evaluate on the same cell although suspect there would still be issues
in a multithreaded environment.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to