Bug 58032 - Better handling of errors when evaluating formulas
Summary: Better handling of errors when evaluating formulas
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.10-FINAL
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-14 07:43 UTC by bardacp
Modified: 2015-06-26 12:09 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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".