Bug 46892 - RecordFormatException when reading Excel workbook
Summary: RecordFormatException when reading Excel workbook
Status: RESOLVED DUPLICATE of bug 46693
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.5-dev
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2009-03-23 08:10 UTC by Nick Giles
Modified: 2009-03-23 14:33 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Nick Giles 2009-03-23 08:10:11 UTC
When attempting to load a file that is readable by 3.2, get the following stack trace:

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:183)


Caused by: org.apache.poi.hssf.record.RecordFormatException: Expected to find a ContinueRecord in order to read remaining 65535 of 65535 chars
	at org.apache.poi.hssf.record.RecordInputStream.readStringCommon(RecordInputStream.java:318)
	at org.apache.poi.hssf.record.RecordInputStream.readUnicodeLEString(RecordInputStream.java:273)
	at org.apache.poi.hssf.record.pivottable.ExtendedPivotTableViewFieldsRecord.<init>(ExtendedPivotTableViewFieldsRecord.java:57)
	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)
	... 42 more

Unable to provide the data file, as it contains data that we cannot distribute, but if there is more info I can collect, happy to do so.
Comment 1 Nick Burch 2009-03-23 08:16:01 UTC
Can you re-test with a recent 3.5 nightly and see if it's fixed there or not?

However, the stack trace does look like your file might be corrupt, or it's possible that the continue record is further from the original record than we expect it to be. Best to know if it's fixed first though
Comment 2 Nick Giles 2009-03-23 08:36:58 UTC
Fails with 3.5-beta5-20090219, I can't find a link to any nightly builds on the website, would I have to download and build from source?

The file opens in Excel, OpenOffice and POI 3.2. It continues to fail to open even when I've deleted every sheet from the workbook, so it looks like it's hidden in the leftovers.
Comment 3 Nick Giles 2009-03-23 08:40:46 UTC
(In reply to comment #2)
> Fails with 3.5-beta5-20090219, I can't find a link to any nightly builds on the
> website, would I have to download and build from source?

And if so, should I just use trunk?
Comment 4 Yegor Kozlov 2009-03-23 08:50:40 UTC
Daily builds can be downlaoded from http://encore.torchbox.com/poi-svn-build/

You say you can reproduce the trouble even if you delete all sheets from the workbook. Can you attach the leftovers? 

Comment 5 Nick Giles 2009-03-23 09:22:57 UTC
It is fixed in poi-3.5-beta6-20090323.jar. A quick test suggests it was actually fixed in poi-3.5-beta6-20090212.jar (poi-3.5-beta6-20090211.jar fails).

I was wrong about being able to reproduce with no sheets though, that was me not hitting refresh in Eclipse enough when testing...

Thanks, I'll probably wait for beta 6 then.
Comment 6 Josh Micich 2009-03-23 14:33:58 UTC
This bug is a duplicate of bug 46693
It's often a good idea to first try searching for existing reports of the same bug, for example:

*** This bug has been marked as a duplicate of bug 46693 ***