Bug 48180

Summary: Error reading Excel document that contains charts
Product: POI Reporter: jason.mckim
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: matt.sgarlata
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.4   
Attachments: Excel sheet with simple chart

Description jason.mckim 2009-11-11 12:03:18 UTC
Whenever I attempt to read the attached document (via Workbook.create(FileInputStream)) I received the exception below:
org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance
	at org.apache.poi.hssf.record.RecordFactory$ReflectionRecordCreator.create(RecordFactory.java:71)
	at org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:269)
	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:409)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:277)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:202)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:318)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:299)
	at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:60)
Caused by: org.apache.poi.hssf.record.RecordFormatException: Not enough data (0) to read requested (6) bytes
	at org.apache.poi.hssf.record.RecordInputStream.checkRecordPosition(RecordInputStream.java:185)
	at org.apache.poi.hssf.record.RecordInputStream.readFully(RecordInputStream.java:250)
	at org.apache.poi.hssf.record.RecordInputStream.readFully(RecordInputStream.java:246)
	at org.apache.poi.hssf.record.chart.ChartEndBlockRecord.<init>(ChartEndBlockRecord.java:44)
	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$ReflectionRecordCreator.create(RecordFactory.java:63)
	... 40 more
Comment 1 jason.mckim 2009-11-11 12:03:56 UTC
Created attachment 24519 [details]
Excel sheet with simple chart
Comment 2 Nick Burch 2009-11-25 04:12:11 UTC
Some of your chart records were shorter than they are supposed to be, I wonder if the file comes from something other than excel?

I've made POI more tolerant of the appropriate records missing some of their data, and POI can now open your file without error. Fix in r884065.
Comment 3 Matthew Sgarlata 2009-11-25 05:35:59 UTC
The file was created in Office 2008 for Mac