I try open a spreadsheet with POI 3.2-final. This is error message: Exception in thread "main" org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:186) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:328) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:271) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:196) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:178) at atd2ltdd.main(atd2ltdd.java:62) Caused by: java.lang.ArrayIndexOutOfBoundsException at org.apache.poi.hssf.record.RecordInputStream.checkRecordPosition(RecordInputStream.java:142) at org.apache.poi.hssf.record.RecordInputStream.readInt(RecordInputStream.java:172) at org.apache.poi.hssf.record.EmbeddedObjectRefSubRecord.<init>(EmbeddedObjectRefSubRecord.java:134) at org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord.java:52) at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:63) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:184) ... 5 more
Created attachment 22860 [details] Input for this bug
Fixed in svn r713852. More tweaks to EmbeddedObjectRefSubRecord (also changed recently in bug 45912). This record has an unusual encoding for one of its string fields: the unicode options byte is omitted when the string length is zero. Prior to this fix, the code was not consistent about this. Junit added.
After I get patch for EmbeddedObjectRefSubRecord.java in svn r713852, then compile POI. But this issue still appears.
Patch version of EmbeddedObjectRefSubRecord in r713852 imported some classes. import org.apache.poi.util.LittleEndianInput; import org.apache.poi.util.LittleEndianInputStream; import org.apache.poi.util.LittleEndianOutput; But they're not in source code of POI 3.2-final. Where do I get them ?
These files were added back in r707450. I guess that was after POI-3.2-FINAL From what I can see these files are present OK in svn trunk. For example: http://svn.apache.org/repos/asf/poi/trunk/src/java/org/apache/poi/util/LittleEndianInput.java Please re-open if you are still having trouble.