diff options
author | Josh Micich <josh@apache.org> | 2008-05-03 20:13:56 +0000 |
---|---|---|
committer | Josh Micich <josh@apache.org> | 2008-05-03 20:13:56 +0000 |
commit | c03173b9606e54582f1f0fff46b287eac33ba34c (patch) | |
tree | 38854900a680b18e7a4deb8a1de1626905854639 /src | |
parent | 1d136b90eb4b4290872275c2e0164669cae4a2f4 (diff) | |
download | poi-c03173b9606e54582f1f0fff46b287eac33ba34c.tar.gz poi-c03173b9606e54582f1f0fff46b287eac33ba34c.zip |
Swapped ArrayIndexOutOfBoundsException for plain array length check in AbstractFunctionPtg.getParameterClass(). (To help debugging when trying to find a real AIOOB)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@653125 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/poi/hssf/record/formula/AbstractFunctionPtg.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/java/org/apache/poi/hssf/record/formula/AbstractFunctionPtg.java b/src/java/org/apache/poi/hssf/record/formula/AbstractFunctionPtg.java index 82d85ccebb..48d7d4cc5b 100644 --- a/src/java/org/apache/poi/hssf/record/formula/AbstractFunctionPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/AbstractFunctionPtg.java @@ -147,10 +147,12 @@ public abstract class AbstractFunctionPtg extends OperationPtg { } public byte getParameterClass(int index) { - try { - return paramClass[index]; - } catch (ArrayIndexOutOfBoundsException aioobe) { + if (index >= paramClass.length) { + // For var-arg (and other?) functions, the metadata does not list all the parameter + // operand classes. In these cases, all extra parameters are assumed to have the + // same operand class as the last one specified. return paramClass[paramClass.length - 1]; } + return paramClass[index]; } } |