Skip to content

Commit

Permalink
Guard against empty or wrong threadGroup names
Browse files Browse the repository at this point in the history
JMeter should always set the names correctly, but that may
not be the case for third-party plugins.
  • Loading branch information
FSchumacher committed Sep 26, 2020
1 parent 30b8f84 commit dd0d5db
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,9 @@ public String getSampleLabel() {
*/
public String getSampleLabel(boolean includeGroup) {
if (includeGroup) {
return threadName.substring(0, threadName.lastIndexOf(' ')) + ":" + label;
// while JMeters own samplers always set the threadName, that might not be the case for plugins
int lastSpacePos = Math.max(0, threadName.lastIndexOf(' '));
return threadName.substring(0, lastSpacePos) + ":" + label;
}
return label;
}
Expand Down

0 comments on commit dd0d5db

Please sign in to comment.