Bug 59073

Summary: Excel 2013 created files not readable
Product: POI Reporter: Marcin <marcin>
Component: HDFAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: normal CC: manojmaruthoor
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Example files

Description Marcin 2016-02-26 08:00:59 UTC
Created attachment 33596 [details]
Example files

I use drools 6.2.0 and excel-based decision tables. Basically you supply XLS 97/2003 file to drools to parse it. Drools is using POI (in my case poi-3.12-20150511.jar). 
I have created empty xls file and POI gives me
org.apache.poi.hssf.record.RecordFormatException: Expected to find a ContinueRecord in order to read remaining 33 of 62 chars
	at org.apache.poi.hssf.record.RecordInputStream.readStringCommon(RecordInputStream.java:377)
	at org.apache.poi.hssf.record.RecordInputStream.readUnicodeLEString(RecordInputStream.java:332)
	at org.apache.poi.hssf.record.FormatRecord.<init>(FormatRecord.java:51)

The same happens for many other files (non-empty).
Comment 1 Marcin 2016-02-26 08:22:30 UTC
org.apache.poi.hssf.record.RecordFormatException: Expected to find a ContinueRecord in order to read remaining 33 of 62 chars
	at org.apache.poi.hssf.record.RecordInputStream.readStringCommon(RecordInputStream.java:356)
	at org.apache.poi.hssf.record.RecordInputStream.readUnicodeLEString(RecordInputStream.java:311)
	at org.apache.poi.hssf.record.FormatRecord.<init>(FormatRecord.java:51)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at org.apache.poi.hssf.record.RecordFactory$ReflectionConstructorRecordCreator.create(RecordFactory.java:87)
	at org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:338)
	at org.apache.poi.hssf.record.RecordFactoryInputStream.readNextRecord(RecordFactoryInputStream.java:285)
	at org.apache.poi.hssf.record.RecordFactoryInputStream.nextRecord(RecordFactoryInputStream.java:251)
	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:480)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:301)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:264)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:199)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:342)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:323)
	at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:76)
	at org.drools.decisiontable.parser.xls.ExcelParser.parseFile(ExcelParser.java:82)
Comment 2 Marcin 2016-02-26 12:00:19 UTC
This was because I used 'Reader' instead of InputStream to read the file.
Stupid mistake.