Bug 46235

Summary: Unable to construct record instance
Product: POI Reporter: yesj <yesj>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P2    
Version: 3.1-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows Server 2003   
Attachments: sample workbook which causes the error

Description yesj 2008-11-18 17:08:43 UTC
Hello, 

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_.close();
            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 : 

poi-3.1-FINAL-20080629.jar
poi-contrib-3.1-FINAL-20080629.jar
poi-scratchpad-3.1-FINAL-20080629.jar

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.

Sincerely
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.

Sincerely