Bug 44593 - Exception while reading by ExcelExtractor
Summary: Exception while reading by ExcelExtractor
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-dev
Hardware: PC Windows XP
: P2 major with 4 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-13 01:16 UTC by Yury Batrakov
Modified: 2009-12-30 17:55 UTC (History)
0 users



Attachments
Excel file that causes an exception (308.63 KB, application/zip)
2008-03-13 01:16 UTC, Yury Batrakov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yury Batrakov 2008-03-13 01:16:03 UTC
Created attachment 21657 [details]
Excel file that causes an exception

I'm using org.apache.poi.hssf.extractor.ExcelExtractor class for reading Excel files and I've got an exception below. Problem file is zipped and attached, I tried to minimize it's contents to make it easier to investigate, but I have no enough Excel knoweledge to figure out what field causes the problem :)

Exception in thread "main" org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance
        at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:199)
        at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:117)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:207)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:259)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:240)
        at org.apache.poi.hssf.extractor.ExcelExtractor.<init>(ExcelExtractor.java:54)
        at org.apache.poi.hssf.extractor.ExcelExtractor.main(ExcelExtractor.java:66)
Caused by: 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:513)
        at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:187)
        ... 6 more
Caused by: java.lang.ArrayIndexOutOfBoundsException
        at org.apache.poi.hssf.record.RecordInputStream.checkRecordPosition(RecordInputStream.java:132)
        at org.apache.poi.hssf.record.RecordInputStream.readShort(RecordInputStream.java:152)
        at org.apache.poi.hssf.util.HSSFCellRangeAddress.fillFields(HSSFCellRangeAddress.java:77)
        at org.apache.poi.hssf.util.HSSFCellRangeAddress.<init>(HSSFCellRangeAddress.java:65)
        at org.apache.poi.hssf.record.DVRecord.fillFields(DVRecord.java:207)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
        at org.apache.poi.hssf.record.DVRecord.<init>(DVRecord.java:134)
        ... 11 more
Comment 1 Nick Burch 2008-03-13 06:19:44 UTC
We were running out of data processing the validation rules in one of the DVRecords

For now, I've tweaked poi to issue a warning in this case, and carry on. Not sure if we'll then have garbage data validation rules then or not, but at least your file can be opened fine, and you ought to be able to get your text out

(Fixed in SVN trunk)
Comment 2 Josh Micich 2009-12-30 17:55:53 UTC
Fixed was applied in svn r636756