Bug 28091 - error opening (foreign) excel file
Summary: error opening (foreign) excel file
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-FINAL
Hardware: PC All
: P3 normal with 1 vote (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-31 14:08 UTC by Alexandra Angibault
Modified: 2008-05-10 19:04 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandra Angibault 2004-03-31 14:08:59 UTC
Hi all,

I have the following problem. I try to open excel files that I received by 
email. I can't open some with POI. But I can open them with Excel 97. They 
aren't protected by a password.
I get the following exception with the HSSF class:

java.lang.ArrayIndexOutOfBoundsException: 11
        at org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:491)
        at org.apache.poi.util.LittleEndian.getInt(LittleEndian.java:139)
        at org.apache.poi.hssf.record.BOFRecord.fillFields(BOFRecord.java:133)
        at org.apache.poi.hssf.record.Record.fillFields(Record.java:90)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
        at org.apache.poi.hssf.record.BOFRecord.<init>(BOFRecord.java:98)
        at org.apache.poi.hssf.dev.BiffViewer.createRecord(BiffViewer.java:251)
        at org.apache.poi.hssf.dev.BiffViewer.createRecords(BiffViewer.java:114)
        at org.apache.poi.hssf.dev.BiffViewer.run(BiffViewer.java:72)
        at org.apache.poi.hssf.dev.BiffViewer.main(BiffViewer.java:649)

C:\Documents and Settings\aangibau\My Documents\projets\Channel Knowledge\Excel 
conversion\Java\Jakart
a POI HSSF>d:\JDK\bin\java HSSF ..\files_to_convert\Lex-LS.xls

C:\Documents and Settings\aangibau\My Documents\projets\Channel Knowledge\Excel 
conversion\Java\Jakart
a POI HSSF>d:\JDK\bin\java HSSF ..\files_to_convert\Lex-
LS.xls ..\converted_files\test.xls
readwrite test
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance
(NativeConstructorAccessorImpl.java:39
)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(DelegatingConstructorAccessorImpl
.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
        at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java:224)
        at org.apache.poi.hssf.record.RecordFactory.createRecords
(RecordFactory.java:160)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:165)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:132)
        at HSSF.<init>(HSSF.java:109)
        at HSSF.main(HSSF.java:345)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 11
        at org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:491)
        at org.apache.poi.util.LittleEndian.getInt(LittleEndian.java:139)
        at org.apache.poi.hssf.record.BOFRecord.fillFields(BOFRecord.java:133)
        at org.apache.poi.hssf.record.Record.fillFields(Record.java:90)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
        at org.apache.poi.hssf.record.BOFRecord.<init>(BOFRecord.java:98)
        ... 10 more
org.apache.poi.hssf.record.RecordFormatException: Unable to construct record 
instance, the following e
xception occured: null
        at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java:237)
        at org.apache.poi.hssf.record.RecordFactory.createRecords
(RecordFactory.java:160)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:165)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:132)
        at HSSF.<init>(HSSF.java:109)
        at HSSF.main(HSSF.java:345)


I tried to read them with BiffViewer and I also got an error:
java.lang.ArrayIndexOutOfBoundsException: 11
        at org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:491)
        at org.apache.poi.util.LittleEndian.getInt(LittleEndian.java:139)
        at org.apache.poi.hssf.record.BOFRecord.fillFields(BOFRecord.java:133)
        at org.apache.poi.hssf.record.Record.fillFields(Record.java:90)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
        at org.apache.poi.hssf.record.BOFRecord.<init>(BOFRecord.java:98)
        at org.apache.poi.hssf.dev.BiffViewer.createRecord(BiffViewer.java:251)
        at org.apache.poi.hssf.dev.BiffViewer.createRecords(BiffViewer.java:114)
        at org.apache.poi.hssf.dev.BiffViewer.run(BiffViewer.java:72)
        at org.apache.poi.hssf.dev.BiffViewer.main(BiffViewer.java:649)

I searched on internet and didn't find any solution.
I hope someone will have an idea.

Thanks

Regards
Comment 1 Josh Micich 2008-05-10 19:04:24 UTC
Support for reading a short BOF record was added with the fix for bug 42794 (svn r594102)

There are no details provided about the offending file.  Hopefully this was the only problem.