Bug 44593

Summary: Exception while reading by ExcelExtractor
Product: POI Reporter: Yury Batrakov <batrakov>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P2    
Version: 3.0-dev   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: Excel file that causes an exception

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