Author: sebb
Date: Tue Mar 25 08:54:24 2008
New Revision: 640866
URL: http://svn.apache.org/viewvc?rev=640866&view=rev
Log:
evalVar cannot be used on Test Plan
Log error rather than generating NPE.
Modified:
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/EvalVarFunction.java
jakarta/jmeter/trunk/xdocs/changes.xml
Modified:
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/EvalVarFunction.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/EvalVarFunction.java?rev=640866&r1=640865&r2=640866&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/EvalVarFunction.java
(original)
+++
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/EvalVarFunction.java
Tue Mar 25 08:54:24 2008
@@ -28,7 +28,10 @@
import org.apache.jmeter.engine.util.CompoundVariable;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.samplers.Sampler;
+import org.apache.jmeter.threads.JMeterVariables;
import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
/**
* Function to evaluate a string which may contain variable or function
references.
@@ -42,6 +45,8 @@
private static final long serialVersionUID = 232L;
+ private static final Logger log = LoggingManager.getLoggerForClass();
+
private static final List desc = new LinkedList();
private static final String KEY = "__evalVar"; //$NON-NLS-1$
@@ -66,8 +71,12 @@
public synchronized String execute(SampleResult previousResult, Sampler
currentSampler)
throws InvalidVariableException {
String variableName = ((CompoundVariable) values[0]).execute();
- String variableValue = getVariables().get(variableName);
- //String parameter = ((CompoundVariable) values[0]).execute();
+ final JMeterVariables vars = getVariables();
+ if (vars == null){
+ log.error("Variables have not yet been defined");
+ return "**ERROR - see log file**";
+ }
+ String variableValue = vars.get(variableName);
CompoundVariable cv = new CompoundVariable(variableValue);
return cv.execute();
}
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=640866&r1=640865&r2=640866&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Tue Mar 25 08:54:24 2008
@@ -108,7 +108,7 @@
<li>Bug 44184 - Allow header to be saved with Aggregate Graph data</li>
<li>Added "Save Table Data" buttons to Aggregate and Summary Reports - save
table as CSV format with header</li>
<li>Allow most functions to be used on the Test Plan.
-Note __split() and __regex() cannot be used on the Test Plan.</li>
+Note __evalVar(), __split() and __regex() cannot be used on the Test Plan.</li>
<li>Allow Global properties to be loaded from a file, e.g.
-Gglobal.properties</li>
<li>Add "Substring" option to Response Assertion</li>
<li>Bug 44378 - Turkish localisation</li>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]