Bug 15228 - [Urgent] ArrayIndexoutofbounds Exception. POI - Version 1.8
Summary: [Urgent] ArrayIndexoutofbounds Exception. POI - Version 1.8
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC All
: P1 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-10 12:15 UTC by gvdinesh
Modified: 2005-03-20 17:06 UTC (History)
1 user (show)



Attachments
sample excel file (648.50 KB, application/octet-stream)
2002-12-12 14:41 UTC, gvdinesh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gvdinesh 2002-12-10 12:15:25 UTC
Hi,
While trying to update a column in a excel file of size 700KB, which also 
contains macros, I am getting arrayindexoutofbounds exception.


The exception is,

java.lang.reflect.InvocationTargetException: 
java.lang.ArrayIndexOutOfBoundsException
	at org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:557)
	at org.apache.poi.util.LittleEndian.getShort(LittleEndian.java:90)
	at org.apache.poi.hssf.record.formula.NamePtg.<init>(NamePtg.java:100)
	at org.apache.poi.hssf.record.formula.Ptg.createPtg(Ptg.java:247)
	at org.apache.poi.hssf.record.FormulaRecord.getParsedExpressionTokens
(FormulaRecord.java:171)
	at org.apache.poi.hssf.record.FormulaRecord.fillFields
(FormulaRecord.java:147)
	at org.apache.poi.hssf.record.Record.fillFields(Record.java:143)
	at org.apache.poi.hssf.record.Record.<init>(Record.java:105)
	at org.apache.poi.hssf.record.FormulaRecord.<init>
(FormulaRecord.java:118)
	at java.lang.reflect.Constructor.newInstance(Native Method)
	at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java:252)
	at org.apache.poi.hssf.record.RecordFactory.createRecords
(RecordFactory.java:190)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:181)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:153)
	at 
com.selectica.foundationservices.daas.command.CxFileReaderCommand.execute
(CxFileReaderCommand.java:83)
	at com.selectica.server.framework.CxCommandExecutor.process
(CxCommandExecutor.java:338)
	at com.selectica.server.framework.CxCommandExecutorRunnable.run
(CxCommandExecutorRunnable.java:282)
	at java.lang.Thread.run(Thread.java:484)

Thanks,
Dinesh
Comment 1 Andy Oliver 2002-12-10 17:12:30 UTC
do NOT reassign bugs to me.
Comment 2 Avik Sengupta 2002-12-12 07:46:51 UTC
This information is NOT enough to debug and/or solve this problem. Please attach
problem .xls and the minumum amount of (compilable) code needed to replicate
this issue. We can then try and resolve this issue. 

Also, to reiterate, assigning bugs to individuals in a voluteer project is
presumptious, to say the least.  
Comment 3 gvdinesh 2002-12-12 14:41:20 UTC
Created attachment 4141 [details]
sample excel file
Comment 4 gvdinesh 2002-12-12 14:42:25 UTC
Hi,
Added attachment file.

This file even fails read.

Sorry for assigning the bug to Andy.

Thanks,
Dinesh
Comment 5 gvdinesh 2002-12-17 15:51:10 UTC
Hi,
I tried to trace through the code. In littleEndian.java 

 private static long getNumber(final byte[] data, final int offset,          
final int size)

the data length is smaller than offset+size-1 and the for loop there fails. So 
it is giving a error while executing the attached file.

Any insights into it.

Thanks,
Dinesh
Comment 6 Paul Krause 2002-12-17 15:55:09 UTC
Is this possibly the same as bug 13292?
Comment 7 Andy Oliver 2003-07-24 14:03:34 UTC
This is fixed and awaiting commit
Comment 8 Avik Sengupta 2003-07-27 19:26:20 UTC
Fixed. comitted to both branch and head. will go into 2.0pre3 release. 
Comment 9 Clay Richardson 2003-08-12 17:56:36 UTC
I am still having this problem with 2.0-pre3.  I have about twenty Excel files, 
all seemingly the same (structurally) and I am batch processing them with Ant, 
and running to this error on half to three quarters of them.

Here is a stack trace:

       [excel] java.lang.reflect.InvocationTargetException
       [excel] 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0
(Native Method)
       [excel] 	at sun.reflect.NativeConstructorAccessorImpl.newInstance
(Unknown Source)
       [excel] 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(Unknown Source)
       [excel] 	at java.lang.reflect.Constructor.newInstance(Unknown Source)
       [excel] 	at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java:257)
       [excel] 	at org.apache.poi.hssf.record.RecordFactory.createRecords
(RecordFactory.java:193)
       [excel] 	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:207)
       [excel] 	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:174)
       [excel] 	at com.etg.ant.ExcelTask.execute(ExcelTask.java:90)
       [excel] 	at com.etg.ant.ExcelTask.execute(ExcelTask.java:61)
       [excel] 	at org.apache.tools.ant.Task.perform(Task.java:319)
       [excel] 	at org.apache.tools.ant.Target.execute(Target.java:309)
       [excel] 	at org.apache.tools.ant.Target.performTasks(Target.java:336)
       [excel] 	at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
       [excel] 	at org.apache.tools.ant.Project.executeTargets
(Project.java:1250)
       [excel] 	at org.eclipse.ant.internal.core.ant.InternalAntRunner.run
(InternalAntRunner.java:569)
       [excel] 	at org.eclipse.ant.internal.core.ant.InternalAntRunner.run
(InternalAntRunner.java:367)
       [excel] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       [excel] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       [excel] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown 
Source)
       [excel] 	at java.lang.reflect.Method.invoke(Unknown Source)
       [excel] 	at org.eclipse.ant.core.AntRunner.run(AntRunner.java:335)
       [excel] 	at 
org.eclipse.ui.externaltools.internal.ant.launchConfigurations.AntLaunchDelegate
$1.run(AntLaunchDelegate.java:172)
       [excel] 	at java.lang.Thread.run(Unknown Source)
       [excel] Caused by: java.lang.ArrayIndexOutOfBoundsException: 11
       [excel] 	at org.apache.poi.util.LittleEndian.getNumber
(LittleEndian.java:529)
       [excel] 	at org.apache.poi.util.LittleEndian.getInt
(LittleEndian.java:177)
       [excel] 	at org.apache.poi.hssf.record.BOFRecord.fillFields
(BOFRecord.java:170)
       [excel] 	at org.apache.poi.hssf.record.Record.fillFields(Record.java:127)
       [excel] 	at org.apache.poi.hssf.record.Record.<init>(Record.java:92)
       [excel] 	at org.apache.poi.hssf.record.BOFRecord.<init>
(BOFRecord.java:135)
       [excel] 	... 24 more

I am looking into whether I can permission to give you one of the files that is 
bombing out, but that may take a little longer, and may not be allowable. 
*sorry, not my call*  :(
Comment 10 Avik Sengupta 2003-08-23 20:02:59 UTC
Clay, 

This particular problem IS fixed.. as proof, there is a testcase (test15228 in
TestBugs.java), that failed prior to the fix, and works now (2.0pre3). 

So your problem is different.. and we will we able to help you only if you give
a small test sheet and the minimum code to replicate this. If you have a problem
providing the sheet, try replicating the problem with dummy data. 
Comment 11 Avik Sengupta 2003-10-06 10:06:59 UTC
As I said earlier, this particular bug IS fixed, there is a testcase to prove
it. Clay, if you are still having a problem, please attach an exmaple sheet and
the minimum amount of code reqd to fix the problem.