Bug 47001

Summary: Cannot read workbook exported from Google Docs
Product: POI Reporter: Josh Micich <josh>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.5-dev   
Target Milestone: ---   
Hardware: All   
OS: All   
URL: http://mail-archives.apache.org/mod_mbox/poi-user/200904.mbox/<e549125d0904071134k42614b69pb9e4fae86347d14@mail.gmail.com>
Attachments: Workbook as exported from google docs

Description Josh Micich 2009-04-08 13:34:58 UTC
Created due to posting by Karim Ratib

org.apache.poi.hssf.record.RecordFormatException: Unable to construct
record instance
	at org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:226)
	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:352)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:276)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:201)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:317)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:298)
	at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:59)
	at TestPOI.main(TestPOI.java:12)
Caused by: org.apache.poi.hssf.record.RecordFormatException: Not
enough data (0) to read requested (1) bytes
	at org.apache.poi.hssf.record.RecordInputStream.checkRecordPosition(RecordInputStream.java:185)
	at org.apache.poi.hssf.record.RecordInputStream.readByte(RecordInputStream.java:193)
	at org.apache.poi.hssf.record.RecordInputStream.readUByte(RecordInputStream.java:223)
	at org.apache.poi.util.StringUtil.readCompressedUnicode(StringUtil.java:121)
	at org.apache.poi.hssf.record.WriteAccessRecord.<init>(WriteAccessRecord.java:62)
	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.createSingleRecord(RecordFactory.java:224)
	... 7 more
Comment 1 Josh Micich 2009-04-08 13:40:00 UTC
Created attachment 23468 [details]
Workbook as exported from google docs
Comment 2 Josh Micich 2009-04-08 14:17:45 UTC
Looks like Google Docs is writing the username field of the WRITEACCESS(0x005C) without the standard string 3 byte header.  The OOO doc says that this is optional, so it seems reasonable that POI should handle that situation.

There an additional problem encountered with the LinkTable.  This workbook is also missing its EXTERNSHEET records.  POI has been changed to tolerate this too.

After the two changes, POI can successfully read and write the workbook.  However, it is not clear whether the problem with the LinkTable has been fully addressed.

Fixed in svn r763391

junits added