You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by jo...@apache.org on 2008/05/03 22:13:57 UTC

svn commit: r653125 - /poi/trunk/src/java/org/apache/poi/hssf/record/formula/AbstractFunctionPtg.java

Author: josh
Date: Sat May  3 13:13:56 2008
New Revision: 653125

URL: http://svn.apache.org/viewvc?rev=653125&view=rev
Log:
Swapped ArrayIndexOutOfBoundsException for plain array length check in AbstractFunctionPtg.getParameterClass(). (To help debugging when trying to find a real AIOOB)

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/AbstractFunctionPtg.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/AbstractFunctionPtg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AbstractFunctionPtg.java?rev=653125&r1=653124&r2=653125&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/AbstractFunctionPtg.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/AbstractFunctionPtg.java Sat May  3 13:13:56 2008
@@ -147,10 +147,12 @@
     }
 
     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];
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org