Author: sebb
Date: Fri Nov 9 14:09:54 2007
New Revision: 593669
URL: http://svn.apache.org/viewvc?rev=593669&view=rev
Log:
Fix NPE
Modified:
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JavaScript.java
Modified:
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JavaScript.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JavaScript.java?rev=593669&r1=593668&r2=593669&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JavaScript.java
(original)
+++
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JavaScript.java
Fri Nov 9 14:09:54 2007
@@ -26,6 +26,8 @@
import org.apache.jmeter.engine.util.CompoundVariable;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.samplers.Sampler;
+import org.apache.jmeter.threads.JMeterContext;
+import org.apache.jmeter.threads.JMeterContextService;
import org.apache.jmeter.threads.JMeterVariables;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.logging.LoggingManager;
@@ -66,7 +68,8 @@
public synchronized String execute(SampleResult previousResult, Sampler
currentSampler)
throws InvalidVariableException {
- JMeterVariables vars = getVariables();
+ JMeterContext jmctx = JMeterContextService.getContext();
+ JMeterVariables vars = jmctx.getVariables();
String script = ((CompoundVariable) values[0]).execute();
// Allow variable to be omitted
@@ -79,9 +82,9 @@
Scriptable scope = cx.initStandardObjects(null);
// Set up some objects for the script to play with
- scope.put("ctx", scope,
currentSampler.getThreadContext()); //$NON-NLS-1$
+ scope.put("ctx", scope, jmctx); //$NON-NLS-1$
scope.put("vars", scope, vars); //$NON-NLS-1$
- scope.put("theadName", scope,
currentSampler.getThreadName()); //$NON-NLS-1$
+ scope.put("theadName", scope,
Thread.currentThread().getName()); //$NON-NLS-1$
scope.put("sampler", scope, currentSampler);
//$NON-NLS-1$
scope.put("sampleResult", scope, previousResult);
//$NON-NLS-1$
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]