Bug 47384 - org.apache.poi.hssf.record.RecordFormatException: Expected to find a ContinueRecord
Summary: org.apache.poi.hssf.record.RecordFormatException: Expected to find a Continue...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.2-FINAL
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-17 08:20 UTC by Vladimir Vilinski
Modified: 2009-06-18 14:16 UTC (History)
0 users



Attachments
Forgotten wrong file (100.50 KB, application/vnd.ms-excel)
2009-06-18 12:17 UTC, Vladimir Vilinski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Vilinski 2009-06-17 08:20:42 UTC
Attached file does not open in poi-3.1-FINAL-20080629.jar


File inputFile = new File("c:\\temp\\in.xls);
String shortInputFileName = inputFile.getName().substring(0,  
InputStream xlsInputStream = new FileInputStream(inputFile);
POIFSFileSystem poiFileSystem = new POIFSFileSystem(xlsInputStream);
HSSFWorkbook wb = new HSSFWorkbook(poiFileSystem);

Following is the error thrown

org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance
	at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:186)
	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:328)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:271)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:196)
	at com.xxxxx.converters.XLSToCSVConverter.convert(XLSToCSVConverter.java:35)
	at com.xxxxx.converters.XLSToCSVConverter.main(XLSToCSVConverter.java:130)
Caused by: org.apache.poi.hssf.record.RecordFormatException: Expected to find a ContinueRecord in order to read remaining 242 of 268 chars
	at org.apache.poi.hssf.record.RecordInputStream.readStringCommon(RecordInputStream.java:284)
	at org.apache.poi.hssf.record.RecordInputStream.readCompressedUnicode(RecordInputStream.java:243)
	at org.apache.poi.hssf.record.ExternalNameRecord.<init>(ExternalNameRecord.java:139)
	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:184)
	... 5 more
Comment 1 Yegor Kozlov 2009-06-18 11:58:12 UTC
There is no file, you seem to forgot to attach it.
Also, can you check the problem file against the latest trunk? Many bugs have been fixed since the release of POI-3.1. 
Daily builds can be downloaded from http://encore.torchbox.com/poi-svn-build/

Yegor
Comment 2 Vladimir Vilinski 2009-06-18 12:17:30 UTC
Created attachment 23830 [details]
Forgotten wrong file

I have deleted the entire content of XLS file but can not read it anway.
We receive hundreds of such files daily from our partners in Czech Republic.
Comment 3 Vladimir Vilinski 2009-06-18 12:19:18 UTC
Attached forgotten file.
Comment 4 Josh Micich 2009-06-18 14:16:21 UTC
Thanks for the sample file.

Fixed in svn r786267

junit added