Bug 45358 - (3.1-FINAL) Array size should be (0) but was (114)
Summary: (3.1-FINAL) Array size should be (0) but was (114)
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-07 15:34 UTC by Zack
Modified: 2008-08-31 19:34 UTC (History)
1 user (show)



Attachments
Template that produce the error (359.10 KB, application/octet-stream)
2008-08-14 03:41 UTC, Antonio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zack 2008-07-07 15:34:45 UTC
When running HSSFFormulaEvaluator.evaluateAllFormulaCells(wb); the following exception occurs:

java.lang.IllegalArgumentException: Array size should be (0) but was (114)
	at org.apache.poi.hssf.record.formula.eval.AreaEvalBase.<init>(AreaEvalBase.java:50)
	at org.apache.poi.hssf.record.formula.eval.Area3DEval.<init>(Area3DEval.java:32)
	at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateArea3dPtg(HSSFFormulaEvaluator.java:510)
	at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateCell(HSSFFormulaEvaluator.java:414)
	at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.internalEvaluate(HSSFFormulaEvaluator.java:338)
	at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateFormulaCell(HSSFFormulaEvaluator.java:183)
	at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateAllFormulaCells(HSSFFormulaEvaluator.java:278)
	at inavero.excelReporter.Generator.start(Generator.java:59)
	at inavero.excelReporter.App$2.handleEvent(App.java:58)
	at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
	at inavero.excelReporter.App.main(App.java:70)

I will try and put together a sanitized spreadsheet as soon as I can that still reproduces the error.
Comment 1 Nick Burch 2008-07-10 14:56:52 UTC
Alas without the sample spreadsheet, we won't be able to figure out what's going wrong (none of our current tests manage to trigger this)

If you could please upload a spreadsheet that triggers this, that'd be wonderful.

(You'll probably find that replacing all the strings and numbers with dummy values using poi will yield a file that triggers the error, but is uploadable to bugzilla)
Comment 2 Tim 2008-08-07 03:17:22 UTC
I have the same issue and it is reproduced by the VLOOKUP function
for example : VLOOKUP(D28;$Z$129:$AE$276;2;0)
All the data within the VLOOKUP does not contain functions.

Kind regards
Comment 3 Antonio 2008-08-14 03:41:28 UTC
Created attachment 22446 [details]
Template that produce the error

This file produce a similar error:

java.lang.IllegalArgumentException: Array size should be (-2) but was (1998)
	at org.apache.poi.hssf.record.formula.eval.AreaEvalBase.<init>(AreaEvalBase.java:50)
	at org.apache.poi.hssf.record.formula.eval.Area3DEval.<init>(Area3DEval.java:32)
	at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateArea3dPtg(HSSFFormulaEvaluator.java:510)
	at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateCell(HSSFFormulaEvaluator.java:414)
	at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.internalEvaluate(HSSFFormulaEvaluator.java:338)
	at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateFormulaCell(HSSFFormulaEvaluator.java:183)


I hope that it is a help to resolve the problem.

PS: The file is compress because it's was so big.
Comment 4 Josh Micich 2008-08-31 19:34:47 UTC
There were 3 problems encountered getting the sample spreadsheet to work with HSSFFormulaEvaluator.evaluateAllFormulaCells(wb).

The first bug was that 3-d area refs like "Sheet1!A10:A40000" had a 16-bit signed/unsigned error. Fixed and junit added in svn r690772.

Secondly there was a major performance problem with all the recursive evaluation of the large areas referenced by the formulas.  Before the fix, evaluation was extremely slow (a test run was terminated after 4 minutes, with no sign of progress).  After the fix, the whole spreadsheet evaluates in about 10 seconds.  It's also likely that the fix for bug 45376 (when it happens) will alleviate things further. This was fixed in  r690835.

Lastly there was a ClassCastException in the implementation of 'IF' due to the first arg not being a plain BoolEval. Fix and junit added in svn r690836.