Bug 44674 - org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance
org.apache.poi.hssf.record.RecordFormatException: Unable to construct record ...
Status: RESOLVED WORKSFORME
Product: POI
Classification: Unclassified
Component: HSSF
unspecified
Sun SunOS
: P1 blocker (vote)
: ---
Assigned To: POI Developers List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2008-03-25 16:21 UTC by Durga Deep Tirunagari
Modified: 2008-03-27 03:54 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Durga Deep Tirunagari 2008-03-25 16:21:50 UTC
We have the latest Apache POI ( 3.0.2 )


org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance
        at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:199)
        at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:117)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:207)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:148)
        at org.apache.poi.hssf.extractor.ExcelExtractor.<init>(ExcelExtractor.java:48)
        at com.sun.comms.iss.indexapi.converter.MSExcelConverter.convertToText(MSExcelConverter.java:103)
Caused by: java.lang.reflect.InvocationTargetException
        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.createRecord(RecordFactory.java:187)
        ... 17 more
Caused by: java.lang.IllegalArgumentException: Illegal length
        at org.apache.poi.hssf.record.RecordInputStream.readCompressedUnicode(RecordInputStream.java:270)
        at org.apache.poi.hssf.record.FileSharingRecord.fillFields(FileSharingRecord.java:62)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
        at org.apache.poi.hssf.record.FileSharingRecord.<init>(FileSharingRecord.java:48)
        ... 22 more
.. Exception... Unable to read entire header; 0 bytes read; expected 512 bytes
Comment 1 Nick Burch 2008-03-26 03:27:52 UTC
Please try with a svn checkout, or a nightly build <http://encore.torchbox.com/poi-svn-build/> - there have been fixes to the filesharing record since 3.0.2

(Please re-open the bug if you still have a problem with a recent nightly build / svn checkout, and also upload the problem file)
Comment 2 Durga Deep Tirunagari 2008-03-26 17:26:17 UTC
Thanks for the quick response. I got the very latest POI and it fixes the bug. 
But I keep getting the following on the console

WARN. Unread -1 bytes of record 0x5b
WARN. Unread -1 bytes of record 0x5b
WARN. Unread -1 bytes of record 0x5b
WARN. Unread -1 bytes of record 0x5b
WARN. Unread -1 bytes of record 0x5b
WARN. Unread -1 bytes of record 0x5b
WARN. Unread -1 bytes of record 0x5b
WARN. Unread -1 bytes of record 0x5b

Thanks Much

Comment 3 Nick Burch 2008-03-27 03:54:33 UTC
Those messages indicate your FileSharingRecords aren't quite what POI was expecting, but can be worked around

If they bug you, tell POILogFactory to use the NullLogger for that class, and they'll go away