You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Marcus Breier <m....@prodata-systems.de> on 2007/06/01 17:38:36 UTC
org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance
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
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org