Author: sebb
Date: Thu Jan  3 08:02:49 2008
New Revision: 608537

URL: http://svn.apache.org/viewvc?rev=608537&view=rev
Log:
Utility function to check exact number of parameters

Modified:
    
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/AbstractFunction.java

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/AbstractFunction.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/AbstractFunction.java?rev=608537&r1=608536&r2=608537&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/AbstractFunction.java 
(original)
+++ 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/AbstractFunction.java 
Thu Jan  3 08:02:49 2008
@@ -86,4 +86,23 @@
                     );
         }
     }
+    /**
+     * Utility method to check parameter counts.
+     * 
+     * @param parameters collection of parameters
+     * @param count number of parameters expected
+     * 
+     * @throws InvalidVariableException if the number of parameters is 
incorrect
+     */
+    protected void checkParameterCount(Collection parameters, int count) 
+        throws InvalidVariableException
+    {
+        int num = parameters.size();
+        if (num != count) {
+            throw new InvalidVariableException(
+                       getReferenceKey() +
+                    " called with wrong number of parameters. Actual: "+num+". 
Expected: "+count+"." 
+                   );
+        }
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to