  | | | "InvocationTargetException " while reading an Excel file. | "InvocationTargetException " while reading an Excel file. 2007-05-03 - By Anjishnu Bandyopadhyay
Back
Hi all,
I am trying to read a MS Excel file through my POI code. The file contains Filters, Macros & Pivot tables. By trying to do so, I get an "InvocationTargetException" when I try to instantiate a new workbook, with an instance of "POIFSFileSystem" class.
My code is something like:
public static synchronized HSSFWorkbook getWorkbook(String filePath)
throws FileNotFoundException, IOException {
FileInputStream fis = new FileInputStream(filePath);
InputStream inputStream = new BufferedInputStream(fis);
POIFSFileSystem fs = new POIFSFileSystem(fis);
HSSFWorkbook workbook = new HSSFWorkbook(fs);
inputStream.close();
return workbook;
}
The stack trace is as follows:
[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr R java.lang.reflect.InvocationTargetException: java.lang.ArrayIndexOutOfBoundsException
[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr R at java.lang.System.arraycopy(Native Method)
[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr R at org.apache.poi.hssf.record.UnknownRecord.<init>(UnknownRecord.java:62)
[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr R at org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord.java:57)
[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr R at org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99)
[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr R at org.apache.poi.hssf.record.Record.fillFields(Record.java(Compiled Code))
[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr R at org.apache.poi.hssf.record.Record.<init>(Record.java(Compiled Code))
[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr R at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:61)
[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr R at java.lang.reflect.Constructor.newInstance(Native Method)
[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr R at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java (Compiled Code))
[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr R at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.jav a(Compiled Code))
[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr R at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:163)
[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr R at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:130)
Is its possible to bypass the problem?
Thanks for your time.
With best regards,
Anjishnu.
**************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e -mail address may be stored on the Infosys e-mail system. ***INFOSYS******** End of Disclaimer ********INFOSYS***
|
|
 |