Can you catch this exception and then printout the contents of
exception.getCause()?  That'll tell you what was the target of the "new"
instance that java thinks it's trying to call and what happened.

>From the javadocs of java.lang.reflect.Constructor.newInstance:
InvocationTargetException - if the underlying constructor throws an
exception.

Jeff Wang
diCarta, Inc.
-----Original Message-----
From: Nick Heudecker [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 09, 2006 1:19 PM
To: [email protected]
Subject: HSSF - Exception thrown when processing Outlook export

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.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

Reply via email to