Bug 44306

Summary: Support getCellFormula() for CHOOSE formulas without triggering EmptyStackException
Product: POI Reporter: Nick Burch <apache>
Component: HSSFAssignee: POI Developers List <dev>
Severity: normal    
Priority: P2    
Version: 3.0-dev   
Target Milestone: ---   
Hardware: Other   
OS: other   

Description Nick Burch 2008-01-28 04:15:42 UTC
On a formula

calling cell.getCellFormula() will blow up with an EmptyStackException

Not sure if it's a bug with the formula parser, or the processing of the Ptgs

Test for the Ptg parsing is in
but may not be fully correct

Test for the usermodel side is in
src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java#test42618() with the
last line calling getCellFormula commented out
Comment 1 Josh Micich 2008-05-18 18:46:26 UTC
Fixed in svn r657702.

There were two problems: tAttrChoose was ignoring the following jump-table and FormulaParser.toFormulaString() needed to handle the extra case of tAttrChoose.

By not reading the extra data belonging to the choose AttrPtg, POI would interpret that data as subsequent Ptgs which had unpredictable results (none good).

Note - as of this fix POI is still not able to evaluate formulas involving CHOOSE() (see bug 45031)