Bug 58032

Summary: Better handling of errors when evaluating formulas
Product: POI Reporter: bardacp
Component: XSSFAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: enhancement    
Priority: P2    
Version: 3.10-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description bardacp 2015-06-14 07:43:09 UTC
When calling evaluate on cell with wrong formula e.g. CONCATENATE("a";) (which excel 2010 does not complain about) POI throws exception:

java.lang.IllegalArgumentException: Unexpected eval class (org.apache.poi.ss.formula.eval.MissingArgEval)

This exception has no information about row/cell.

It would be nice if thrown exception contained information about position(row, cell) of wrong formula.
Comment 1 Nick Burch 2015-06-14 12:15:08 UTC
Surely when you call FormulaEvaluator.evaluateFormulaCell(Cell), you have the Cell object to know what the co-ordinates of the problematic formula are?
Comment 2 bardacp 2015-06-14 14:06:41 UTC
Sure but first time I was using API I used https://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/FormulaEvaluator.html#evaluateAll%28%29 where exception occured. From this exception I had no idea what was wrong, I had to debug POI classes to know what is wrong. If the text of exception was like "Wrong formula in cell BJ58" instead of "Unexpected eval class" it would save me a lot of time.

So method evaluateFormulaCell can be used if I want to know positions but I have to iterate sheets, cell, rows -> more code but still it throws "Unexpected eval class".