Author: pmouawad
Date: Sat Mar 9 16:36:50 2019
New Revision: 1855127
URL: http://svn.apache.org/viewvc?rev=1855127&view=rev
Log:
Bug 63241 - __threadGroupName causes a NullPointerException if called from non
Test threads
Bugzilla Id: 63241
Modified:
jmeter/trunk/src/functions/org/apache/jmeter/functions/ThreadGroupName.java
jmeter/trunk/xdocs/changes.xml
Modified:
jmeter/trunk/src/functions/org/apache/jmeter/functions/ThreadGroupName.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/ThreadGroupName.java?rev=1855127&r1=1855126&r2=1855127&view=diff
==============================================================================
--- jmeter/trunk/src/functions/org/apache/jmeter/functions/ThreadGroupName.java
(original)
+++ jmeter/trunk/src/functions/org/apache/jmeter/functions/ThreadGroupName.java
Sat Mar 9 16:36:50 2019
@@ -23,6 +23,7 @@ import java.util.List;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.samplers.Sampler;
+import org.apache.jmeter.threads.AbstractThreadGroup;
import org.apache.jmeter.threads.JMeterContext;
import org.apache.jmeter.threads.JMeterContextService;
@@ -51,7 +52,13 @@ public class ThreadGroupName extends Abs
} else {
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} */
Modified: jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1855127&r1=1855126&r2=1855127&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Mar 9 16:36:50 2019
@@ -154,6 +154,7 @@ Summary
<h3>Functions</h3>
<ul>
+ <li><bug>63241</bug><code>__threadGroupName</code> causes a
NullPointerException if called from non Test threads</li>
</ul>
<h3>I18N</h3>