On a formula =CHOOSE(2,A2,A3,A4) 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 src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java#testWithConcat() 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
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)