DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42564>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42564

           Summary: org.apache.poi.hssf.record.RecordFormatException: Unable
                    to construct record instance
           Product: POI
           Version: 3.0
          Platform: Macintosh
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Hi there ...

recently I got the Exception printed below while reading an Excel file that has
been exported by MS Access to "Excel 97-2002 & 5.0/95 Workbook" format. 

DEBUG: type = 5; currentLength = 8; recordOffset = 8

org.apache.poi.hssf.record.RecordFormatException: Unable to construct record
instance
        at 
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:191)
        at 
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:115)
        at 
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:205)
        at 
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:153)
        ... 50 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:179)
        ... 54 more
Caused by: java.lang.ArrayIndexOutOfBoundsException
        at
org.apache.poi.hssf.record.RecordInputStream.checkRecordPosition(RecordInputStream.java:132)
        at 
org.apache.poi.hssf.record.RecordInputStream.readInt(RecordInputStream.java:155)
        at org.apache.poi.hssf.record.BOFRecord.fillFields(BOFRecord.java:121)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:56)
        at org.apache.poi.hssf.record.BOFRecord.<init>(BOFRecord.java:99)
        ... 59 more

When the exported Excel file has been reopened and saved with Excel, everything
is ok. 

DEBUG: type = 5; currentLength = 16; recordOffset = 8; sid = 2057;
ContinueRecord.sid = 60
DEBUG: type = 16; currentLength = 16; recordOffset = 8; sid = 2057;
ContinueRecord.sid = 60


To get a clue why these exceptions occur I put some debug code into
BOFRecord.fillFields(RecordInputStream in) to produce the DEBUG output stated 
above:

...
protected void fillFields(RecordInputStream in)
{

    field_1_version  = in.readShort();
    field_2_type     = in.readShort();
    field_3_build    = in.readShort();
    field_4_year     = in.readShort();

    System.out.println("DEBUG: type = "+getType()+"; "+
                                                  "currentLength = 
"+in.getLength()+"; "+
                                                  "recordOffset = 
"+in.getRecordOffset()+"; "+
                                                  "sid = "+in.getSid()+"; "+
                                                  "ContinueRecord.sid = 
"+ContinueRecord.sid);

        field_5_history  = in.readInt();
        field_6_rversion = in.readInt();
}
...

Since I have not a clue what's up with this SID stuff, so what can I do to fix
this problem?

Regards
Marcus

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to