mirror of https://github.com/apache/jmeter.git
Bug 63241 - __threadGroupName causes a NullPointerException if called from non Test threads
Bugzilla Id: 63241
git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1855127 13f79535-47bb-0310-9956-ffa450edef68
Former-commit-id: ad2f5a8247
This commit is contained in:
parent
053dc645ac
commit
9a0e28e169
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.apache.jmeter.samplers.SampleResult;
|
import org.apache.jmeter.samplers.SampleResult;
|
||||||
import org.apache.jmeter.samplers.Sampler;
|
import org.apache.jmeter.samplers.Sampler;
|
||||||
|
import org.apache.jmeter.threads.AbstractThreadGroup;
|
||||||
import org.apache.jmeter.threads.JMeterContext;
|
import org.apache.jmeter.threads.JMeterContext;
|
||||||
import org.apache.jmeter.threads.JMeterContextService;
|
import org.apache.jmeter.threads.JMeterContextService;
|
||||||
|
|
||||||
|
|
@ -51,7 +52,13 @@ public class ThreadGroupName extends AbstractFunctionByKey {
|
||||||
} else {
|
} else {
|
||||||
context = JMeterContextService.getContext();
|
context = JMeterContextService.getContext();
|
||||||
}
|
}
|
||||||
return context.getThreadGroup().getName();
|
AbstractThreadGroup threadGroup = context.getThreadGroup();
|
||||||
|
if (threadGroup != null) {
|
||||||
|
return threadGroup.getName();
|
||||||
|
} else {
|
||||||
|
// Can happen if called from GUI or from non test threads
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,7 @@ Summary
|
||||||
|
|
||||||
<h3>Functions</h3>
|
<h3>Functions</h3>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li><bug>63241</bug><code>__threadGroupName</code> causes a NullPointerException if called from non Test threads</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3>I18N</h3>
|
<h3>I18N</h3>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue