Bug 8592 - FORMULAS -- Strange bug with Formulas
Summary: FORMULAS -- Strange bug with Formulas
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-dev
Hardware: Other other
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
: 8593 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-04-27 22:17 UTC by Andy Oliver
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Oliver 2002-04-27 22:17:13 UTC
In the event more than 3 rows contain formuls the following exception occurs:

There was 1 error:
1) testAddIntegers(org.apache.poi.hssf.usermodel.TestFormulas)
java.lang.ArrayIndexOutOfBoundsException
        at org.apache.poi.util.LittleEndian.putNumber(LittleEndian.java:536)
        at org.apache.poi.util.LittleEndian.putShort(LittleEndian.java:243)
        at
org.apache.poi.hssf.record.SelectionRecord.serialize(SelectionRecord.java:262)
        at org.apache.poi.hssf.model.Sheet.serialize(Sheet.java:584)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.getBytes(HSSFWorkbook.java:522)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:474)
        at
org.apache.poi.hssf.usermodel.TestFormulas.testAddIntegers(TestFormulas.java:130)
        at org.apache.poi.hssf.usermodel.TestFormulas.main(TestFormulas.java:157)
Comment 1 Andy Oliver 2002-04-28 00:42:14 UTC
*** Bug 8593 has been marked as a duplicate of this bug. ***
Comment 2 Andy Oliver 2002-04-28 00:48:25 UTC
Turned out that formulas only worked by cooincidence.  There was a horrid
mismatch between Formula Records and Value Records aggregate.  Basically we
couldn't handle records whose size changed later.  Calculating it earlier was
more efficient but later lets us handle this.  At some point this should be
revisited for optimization.  If some manner of lightweight notification could be
performed then we could calculate size early and only update the deltas.  Might
not be worth it for most sheets.  (Then again...it might)  Another approach
might make a collection of only VariableSizeCellRecords (of which there are
fewer on average) and only calculate them at the end.  Regardless this works now.