Bug 46235 - Unable to construct record instance
Summary: Unable to construct record instance
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.1-FINAL
Hardware: PC Windows Server 2003
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2008-11-18 17:08 UTC by yesj
Modified: 2008-11-18 19:21 UTC (History)
0 users

sample workbook which causes the error (394.50 KB, application/vnd.ms-excel)
2008-11-18 19:21 UTC, yesj

Note You need to log in before you can comment on or make changes to this bug.
Description yesj 2008-11-18 17:08:43 UTC

with the version 3.1.0 of POI I can do this code : 

 ByteArrayInputStream  instream_ = null; 
        POIFSFileSystem fs = null;       
        POIManagerFactory managerFactory = null;
        try {
            workbook = null;

            instream_ = new ByteArrayInputStream(_byteFile);

           fs = new POIFSFileSystem(instream_);  

            workbook = new HSSFWorkbook(fs);  

            instream_ = null;
            fs = null;
       } catch (Exception e) {
            throw new SystemException(e.getMessage(), e);

However, when I want to open the attachment file, exception occurred,
other file  is possible .
workbook = new HSSFWorkbook(fs);  
// Exception with 3.1 no probleme with 2.5

I use for POI 3.1 : 


The Exception is : 

Caused by: org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance
 at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:208)
 at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:126)
 at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:246)
 at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:169)
 at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:151)
 at jp.co.nttdata_chugoku.sprist.scm.common.comservice.POIManagerImpl.getHSSFWorkbook(POIManagerImpl.java:53)
 at jp.co.nttdata_chugoku.sprist.scm.common.comservice.MakeExcelCom.<init>(MakeExcelCom.java:150)
 ... 59 more
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:274)
 at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:196)
 ... 65 more
Caused by: org.apache.poi.hssf.record.RecordFormatException: Expected continue record.
 at org.apache.poi.hssf.record.UnicodeString.fillFields(UnicodeString.java:236)
 at org.apache.poi.hssf.record.UnicodeString.<init>(UnicodeString.java:115)
 at org.apache.poi.hssf.record.SSTDeserializer.manufactureStrings(SSTDeserializer.java:49)
 at org.apache.poi.hssf.record.SSTRecord.fillFields(SSTRecord.java:364)
 at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
 at org.apache.poi.hssf.record.SSTRecord.<init>(SSTRecord.java:101)

NB : the file that I open is on my station.

Comment 1 Josh Micich 2008-11-18 18:24:07 UTC
There have been some recent changes/fixes in ContinueRecord processing.  Try with POI 3.2

If the problem is still present, please re-open this bugzilla and upload a sample workbook which causes the error.
Comment 2 yesj 2008-11-18 19:21:22 UTC
Created attachment 22890 [details]
sample workbook which causes the error 

where I use poi3.2,the problem is still present, I have uploaded a
sample workbook which causes the error at this bugzilla.