The attached spreadsheet has just one formula. It looks like this: D3+PriceDown where PriceDown is a Name. You get the following exception when using BiffViewer: java.lang.ArrayIndexOutOfBoundsException at org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:557) at org.apache.poi.util.LittleEndian.getShort(LittleEndian.java:90) at org.apache.poi.hssf.record.formula.NamePtg.<init>(NamePtg.java:100) at org.apache.poi.hssf.record.formula.Ptg.createPtg(Ptg.java:251) at org.apache.poi.hssf.record.FormulaRecord.getParsedExpressionTokens(Fo rmulaRecord.java:171) at org.apache.poi.hssf.record.FormulaRecord.fillFields(FormulaRecord.jav a:147) at org.apache.poi.hssf.record.Record.fillFields(Record.java:143) at org.apache.poi.hssf.record.Record.<init>(Record.java:105) at org.apache.poi.hssf.record.FormulaRecord.<init>(FormulaRecord.java:11 8) at org.apache.poi.hssf.dev.BiffViewer.createRecord(BiffViewer.java:550) at org.apache.poi.hssf.dev.BiffViewer.createRecords(BiffViewer.java:158) at org.apache.poi.hssf.dev.BiffViewer.run(BiffViewer.java:110) at org.apache.poi.hssf.dev.BiffViewer.main(BiffViewer.java:687) It seems to happen only when you mix non-named cell references with named ones. For example, I tried formulae like C1+D1 and Name1:Name2 and they both parsed.
Created attachment 3814 [details] Minimal XLS file that demonstrates the problem
This is fixed in latest CVS, and also possibly in 2.0pre3. Added the xls file as a testcase. (HEAD tho is hosed!)