Bug 59073 - Excel 2013 created files not readable
Summary: Excel 2013 created files not readable
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: HDF (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-26 08:00 UTC by Marcin
Modified: 2016-04-20 11:44 UTC (History)
1 user (show)



Attachments
Example files (14.28 KB, application/x-zip-compressed)
2016-02-26 08:00 UTC, Marcin
Details

Note You need to log in before you can comment on or make changes to this bug.
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.