Hi, I am getting the following error. Please let me know how can I send the sample attachment for which this problem is occurring. Regards, Sandeep Giri ------------------------------ java.lang.reflect.InvocationTargetException 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:237) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:160) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:183) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:152) at transbit.tbits.Helper.Xls2csv.getText(Xls2csv.java:42) at transbit.tbits.Helper.Xls2csv.getText(Xls2csv.java:32) at transbit.tbits.common.Readerizer.readerizeExcelFiles(Readerizer.java:322) at transbit.tbits.common.Readerizer.readerize(Readerizer.java:209) at transbit.tbits.common.Readerizer.main(Readerizer.java:136) Caused by: java.lang.ArrayIndexOutOfBoundsException: 33 at org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:491) at org.apache.poi.util.LittleEndian.getShort(LittleEndian.java:52) at org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:98) at org.apache.poi.hssf.record.Record.fillFields(Record.java:90) at org.apache.poi.hssf.record.Record.<init>(Record.java:55) at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:61) ... 13 more org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance, the following exception occured: null at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:250) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:160) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:183) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:152)
You should attach the problem file to this bugzilla entry
Created attachment 21679 [details] An excel file that fails in the constructor with RecordFormatException: "Unable to construct record instance" Assuming xlsFile is a File object that points to the Problem.xls file the following code fails: inputStream_ = new FileInputStream( xlsFile ); POIFSFileSystem fs = new POIFSFileSystem( inputStream_ ); workbook_ = new HSSFWorkbook( fs ); //FAILS HERE Here's a stack trace: org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:199) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:117) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:207) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:148) at com.snowfly.spincast.XlsSheetList.open(XlsSheetList.java:50) at com.snowfly.spincast.XlsSheetList.<init>(XlsSheetList.java:36) at com.snowfly.spincast.client.XLSFileImporter.processFile(XLSFileImporter.java:63) at com.snowfly.spincast.client.XLSFileImporter.doImport(XLSFileImporter.java:45) at com.snowfly.spincast.Task.process(Task.java:74) at com.snowfly.spincast.TaskManager.process(TaskManager.java:33) at com.snowfly.spincast.Spincast.main(Spincast.java:34) 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:513) at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:187) ... 10 more Caused by: java.lang.IllegalArgumentException: Illegal length at org.apache.poi.hssf.record.RecordInputStream.readCompressedUnicode(RecordInputStream.java:270) at org.apache.poi.hssf.record.FileSharingRecord.fillFields(FileSharingRecord.java:62) at org.apache.poi.hssf.record.Record.<init>(Record.java:55) at org.apache.poi.hssf.record.FileSharingRecord.<init>(FileSharingRecord.java:48) ... 15 more
I've just tried the attached spreadsheet, and it opens just fine with svn trunk I've added a new test to the test suite, so we can ensure this doesn't get broken again in future