Bug 48699

Summary: RecordFormatException: Unexpected remaining size (12)
Product: POI Reporter: Erwin <mail.metallo.now>
Component: HSSFAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: normal CC: mail.metallo.now
Priority: P2    
Version: 3.12-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: the excel

Description Erwin 2010-02-08 05:19:14 UTC
Created attachment 24945 [details]
the excel

After upgrading from POI 3.2 to 3.6 we get an error while reading an excisting Excel 2003 and writing an updated version to another file. You can find the Excel in attachment.

Code:

InputStream inp = new FileInputStream(file);
wb_xls = new HSSFWorkbook(inp);

Tracing:

org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance
	at org.apache.poi.hssf.record.RecordFactory$ReflectionRecordCreator.create(RecordFactory.java:64)
	at org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:263)
	at org.apache.poi.hssf.record.RecordFactoryInputStream.readNextRecord(RecordFactoryInputStream.java:270)
	at org.apache.poi.hssf.record.RecordFactoryInputStream.nextRecord(RecordFactoryInputStream.java:236)
	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:392)
	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 be.mc.system.poi.excel.ExcelFromList.makeXLSWorkBook(ExcelFromList.java:387)
	at be.mc.system.poi.excel.ExcelFromList.generateReport(ExcelFromList.java:170)
	at be.mc.system.poi.excel.ExcelFromList.send(ExcelFromList.java:235)
	at be.mc.system.scheduler.server.ScheduleExportJob.execute(ScheduleExportJob.java:165)
	at be.ldc.trading.orderheader.export.ExportJob.execute(ExportJob.java:44)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
Caused by: org.apache.poi.hssf.record.RecordFormatException: Unexpected remaining size (12)
	at org.apache.poi.hssf.record.pivottable.ExtendedPivotTableViewFieldsRecord.<init>(ExtendedPivotTableViewFieldsRecord.java:68)
	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:494)
	at org.apache.poi.hssf.record.RecordFactory$ReflectionRecordCreator.create(RecordFactory.java:56)
	... 15 more



Checking the file with the BiffViewer gives us the following error:



Offset=0x0020A085(2138245) recno=137008 sid=0x00EC size=0x00AA(170)
[MSODRAWING]
No Escher Records Decoded
[/MSODRAWING]

Offset=0x0020A133(2138419) recno=137009 sid=0x005D size=0x0046(70)
java.lang.NullPointerException
        at org.apache.poi.hssf.record.LbsDataSubRecord.toString(LbsDataSubRecord
.java:246)
        at org.apache.poi.hssf.record.ObjRecord.toString(ObjRecord.java:146)
        at org.apache.poi.hssf.dev.BiffViewer.createRecords(BiffViewer.java:97)
        at org.apache.poi.hssf.dev.BiffViewer.main(BiffViewer.java:401)
Comment 1 Dominik Stadler 2015-05-22 15:58:29 UTC
still happens with current release.