https://bz.apache.org/bugzilla/show_bug.cgi?id=69650

            Bug ID: 69650
           Summary: Throw Exception java.lang.IllegalStateException: value
                    changed in this methos
                    ss.formula.EvaluationCache.getPlainValueEntry
           Product: POI
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: hasmukh.gin...@automationanywhere.com
  Target Milestone: ---

My Excel file having 
A1 -> Cell Value ( 1)
A2 -> Cell Value (2)
A3 -> Cell Value (3)
A4 -> =SUM(A1:A3)

I have create my logic like it reads the Value of Row A1 to A4 and also do set
cell Value like

Loop i to 1 to 4
   Read Ai
   Set Ai

When Loop executed at A4 then it throws exception

Caused by: java.lang.IllegalStateException: value changed
        at
org.apache.poi.ss.formula.EvaluationCache.getPlainValueEntry(EvaluationCache.java:135)
~[?:?]
        at
org.apache.poi.ss.formula.EvaluationTracker.acceptPlainValueDependency(EvaluationTracker.java:143)
~[?:?]
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:242)
~[?:?]
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateReference(WorkbookEvaluator.java:791)
~[?:?]
        at
org.apache.poi.ss.formula.SheetRefEvaluator.getEvalForCell(SheetRefEvaluator.java:48)
~[?:?]
        at
org.apache.poi.ss.formula.SheetRangeEvaluator.getEvalForCell(SheetRangeEvaluator.java:77)
~[?:?]
        at
org.apache.poi.ss.formula.LazyAreaEval.getRelativeValue(LazyAreaEval.java:54)
~[?:?]
        at
org.apache.poi.ss.formula.eval.AreaEvalBase.getValue(AreaEvalBase.java:143)
~[?:?]
        at
org.apache.poi.ss.formula.functions.MultiOperandNumericFunction.collectValues(MultiOperandNumericFunction.java:149)
~[?:?]
        at
org.apache.poi.ss.formula.functions.MultiOperandNumericFunction.getNumberArray(MultiOperandNumericFunction.java:118)
~[?:?]
        at
org.apache.poi.ss.formula.functions.MultiOperandNumericFunction.evaluate(MultiOperandNumericFunction.java:81)
~[?:?]
        at
org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(OperationEvaluatorFactory.java:133)
~[?:?]
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:537)
~[?:?]
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:264)
~[?:?]
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:205)
~[?:?]
        at
org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.evaluateFormulaCellValue(BaseXSSFFormulaEvaluator.java:61)
~[?:?]
        at
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluateFormulaCell(BaseFormulaEvaluator.java:184)
~[?:?]
        at
org.apache.poi.ss.usermodel.DataFormatter.formatCellValue(DataFormatter.java:1120)
~[?:?]

As I was Searching , then in POI document mentioned that 
For performance reasons, this class keeps a cache of all previously calculated
intermediate cell values. Be sure to call clearAllCachedResultValues() if any
workbook cells are changed between calls to evaluate~ methods on this class.

So Every After Set cell I have call clearAllCachedResultValues() , 
Can you please suggest weather this is right solution or not in such case ?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to