You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2011/05/26 18:58:36 UTC

DO NOT REPLY [Bug 51273] New: ArrayIndexOutOfBoundsException in FormulaCellCacheEntrySet

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: dev@poi.apache.org
        ReportedBy: amountney@cnsonline.net
    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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 51273] ArrayIndexOutOfBoundsException in FormulaCellCacheEntrySet

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51273

Nick Burch <ni...@alfresco.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #1 from Nick Burch <ni...@alfresco.com> 2011-05-27 11:46:37 UTC ---
Should be fixed in r1128268 - looks like there was a missing Math.abs

Note however that if you're updating cells after having done one calculation,
you do need to tell the formula evaluator so it can tweak its cache.

-- 
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org