I'm encountering the following exception when I upload an Excel spreadsheet
created by Outlook:
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:494)
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
:230)
at org.apache.poi.hssf.usermodel.HSSFWorkbook .<init>(HSSFWorkbook.java
:211)
at example.service.impl.ContactServiceImpl.uploadContacts(
ContactServiceImpl.java:137)
// WEB STACK OMITTED
Caused by: java.lang.ArrayIndexOutOfBoundsException: 11
at org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:491)
at org.apache.poi.util.LittleEndian.getInt(LittleEndian.java:139)
at org.apache.poi.hssf.record.BOFRecord.fillFields(BOFRecord.java:133)
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.BOFRecord.<init>(BOFRecord.java:98)
... 48 more
I don't seem to have this problem if I open the spreadsheet and save it
before uploading. However, it dies if I try to process the file straight
from Outlook. I save the entire file to a temp location before trying to
process it.
I realize this is a little off the wall, but any help would be appreciated.
Worst case, I'll fall back to CSV format.