RaviKiran
RaviKiran

Reputation: 645

error reading an excel file

I am using HSSF in my web application to read an excel file uploaded by the user.
The application is struts based and the input stream from the struts.upload.FormFile object is passed to the POIFSFileSystem constructor.
I am getting the following error when trying to parse a particular excel file:

java.lang.reflect.InvocationTargetException: 
java.lang.ArrayIndexOutOfBoundsException: 11 
        at 
org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java(Inlined 
Compiled Code)) 
        at 
org.apache.poi.util.LittleEndian.getShort(LittleEndian.java(Compiled 
Code)) 
        at 
org.apache.poi.hssf.record.MulRKRecord.fillFields(MulRKRecord.java:153) 
        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.MulRKRecord.<init>(MulRKRecord.java:65) 

However a stand alone test class using HSSF parses the same file without any problem. I am using POI ver 2.5.

I don't know where to start debugging :-(

Has anyone encountered similar problems? Please let me know.

Upvotes: 1

Views: 683

Answers (1)

Gagravarr
Gagravarr

Reputation: 48326

You do know that POI 2.5 dates from March 2004, don't you? That's over 7 years old!

I'd strongly suggest you upgrade to a newer version, such as POI 3.8 beta 5 - there have been 7 years of bug fixes that you're missing....! Armed with a version of POI from this decade (and ideally from this year), there's a very very strong chance that your problem will go away, and you'll be able to read your file without error.

Upvotes: 3

Related Questions