You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2008/01/03 16:14:10 UTC

svn commit: r608519 - /jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/AbstractFunction.java

Author: sebb
Date: Thu Jan  3 07:14:09 2008
New Revision: 608519

URL: http://svn.apache.org/viewvc?rev=608519&view=rev
Log:
Improve parameter checking message

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=608519&r1=608518&r2=608519&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 07:14:09 2008
@@ -45,7 +45,9 @@
 
 	/**
 	 * @see Function#setParameters(Collection)
-     * Note: This may not be called (e.g. if no parameters are provided)
+	 * <br/>
+     * Note: This is always called even if no parameters are provided 
+     * (versions of JMeter after 2.3.1)
      * 
 	 */
 	abstract public void setParameters(Collection parameters) throws InvalidVariableException;
@@ -59,8 +61,14 @@
 		return JMeterContextService.getContext().getVariables();
 	}
     
-    /*
-     * Utility method to check parameter counts 
+    /**
+     * Utility method to check parameter counts.
+     * 
+     * @param parameters collection of parameters
+     * @param min minimum number of parameters allowed
+     * @param max maximum number of parameters allowed
+     * 
+     * @throws InvalidVariableException if the number of parameters is incorrect
      */
     protected void checkParameterCount(Collection parameters, int min, int max) 
         throws InvalidVariableException
@@ -68,9 +76,13 @@
         int num = parameters.size();
         if ((num > max) || (num < min)) {
             throw new InvalidVariableException(
-                    "Wrong number of parameters. Actual: "+num+
-                    ". Expected: >= "+min
-                    +" and <= "+max
+            		getReferenceKey() +
+                    " called with wrong number of parameters. Actual: "+num+
+                    (
+                    	min==max ? 
+                    	". Expected: "+min+"." 
+                    	: ". Expected: >= "+min+" and <= "+max
+                    )
                     );
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org