Bug 14330 - Error reading FormulaRecord
Summary: Error reading FormulaRecord
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-07 08:26 UTC by Michael Tosdevin
Modified: 2005-03-20 17:06 UTC (History)
0 users



Attachments
Test workbook demonstrating error (47.50 KB, application/vnd.ms-excel)
2002-11-07 08:28 UTC, Michael Tosdevin
Details
This simple file replicates the problem. It appears to be due to the way in which strings are handled by StringPtg. The problem does not occur with SSTRecord (see next attachment). (13.50 KB, application/vnd.ms-excel)
2002-12-06 13:50 UTC, Michael Tosdevin
Details
This file does not have the problem even though it uses the same characters. LabelSSTRecord and SSTRecord appear to handle the character properly. (13.50 KB, application/vnd.ms-excel)
2002-12-06 13:51 UTC, Michael Tosdevin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Tosdevin 2002-11-07 08:26:21 UTC
This seems similar to Bug 13796. The same workbook causes a similar, but 
different, error in the usermodel.examples.EventExample class (recompiled, 
unchanged, into my own package for simplicity). Namely:

java.lang.reflect.InvocationTargetException: java.lang.StringIndexOutOfBoundsExc
eption: String index out of range: 45
        at java.lang.String.<init>(Unknown Source)
        at java.lang.String.<init>(Unknown Source)
        at org.apache.poi.hssf.record.formula.StringPtg.<init>(StringPtg.java:82
)
        at org.apache.poi.hssf.record.formula.Ptg.createPtg(Ptg.java:244)
        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 java.lang.reflect.Constructor.newInstance(Native Method)
        at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.j
ava:252)
        at org.apache.poi.hssf.eventmodel.HSSFEventFactory.genericProcessEvents(
HSSFEventFactory.java:221)
        at org.apache.poi.hssf.eventmodel.HSSFEventFactory.processEvents(HSSFEve
ntFactory.java:139)
        at omvuk.util.EventExample.main(EventExample.java:93)
Exception in thread "main" org.apache.poi.hssf.record.RecordFormatException: Una
ble to construct record instance, the following exception occured: null
        at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.j
ava:265)
        at org.apache.poi.hssf.eventmodel.HSSFEventFactory.genericProcessEvents(
HSSFEventFactory.java:221)
        at org.apache.poi.hssf.eventmodel.HSSFEventFactory.processEvents(HSSFEve
ntFactory.java:139)
        at omvuk.util.EventExample.main(EventExample.java:93)
Comment 1 Michael Tosdevin 2002-11-07 08:28:51 UTC
Created attachment 3766 [details]
Test workbook demonstrating error
Comment 2 Michael Tosdevin 2002-12-06 13:50:25 UTC
Created attachment 4065 [details]
This simple file replicates the problem. It appears to be due to the way in which strings are handled by StringPtg. The problem does not occur with SSTRecord (see next attachment).
Comment 3 Michael Tosdevin 2002-12-06 13:51:57 UTC
Created attachment 4066 [details]
This file does not have the problem even though it uses the same characters. LabelSSTRecord and SSTRecord appear to handle the character properly.
Comment 4 Avik Sengupta 2003-10-06 17:49:16 UTC
Works in CVS and possible 2.0pre3. Will be in the pre4 release. 

Added both problem files as testcases. See test14330 in TestBugs.java