StringIndexOutOfBoundsException at SampleResult.getSampleLabel() if key_on_threadname=false when using Statistical mode

Bugzilla Id: 5473


git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1461380 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2013-03-27 00:48:57 +00:00
parent 46b10c19ad
commit fa1260e00f
3 changed files with 16 additions and 6 deletions

View File

@ -56,21 +56,30 @@ public class StatisticalSampleResult extends SampleResult implements
* Create a statistical sample result from an ordinary sample result.
*
* @param res the sample result
* @param keyOnThreadName true if key includes threadName, false if threadGroup
*/
public StatisticalSampleResult(SampleResult res, boolean keyOnThreadName) {
public StatisticalSampleResult(SampleResult res) {
// Copy data that is shared between samples (i.e. the key items):
setSampleLabel(res.getSampleLabel());
if (keyOnThreadName) {
setThreadName(res.getThreadName());
}
setThreadName(res.getThreadName());
setSuccessful(true); // Assume result is OK
setSampleCount(0); // because we add the sample count in later
elapsed = 0;
}
/**
* Create a statistical sample result from an ordinary sample result.
*
* @param res the sample result
* @param unused no longer used
* @deprecated no longer necessary; use {@link #StatisticalSampleResult(SampleResult)} instead
*/
@Deprecated
public StatisticalSampleResult(SampleResult res, boolean unused) {
this(res);
}
public void add(SampleResult res) {
// Add Sample Counter
setSampleCount(getSampleCount() + res.getSampleCount());

View File

@ -149,7 +149,7 @@ public class StatisticalSampleSender extends AbstractSampleSender implements Ser
String key = StatisticalSampleResult.getKey(e, keyOnThreadName);
StatisticalSampleResult statResult = sampleTable.get(key);
if (statResult == null) {
statResult = new StatisticalSampleResult(e.getResult(), keyOnThreadName);
statResult = new StatisticalSampleResult(e.getResult());
// store the new statistical result collector
sampleTable.put(key, statResult);
// add a new wrapper samplevent

View File

@ -109,6 +109,7 @@ This does not affect JMeter operation.
<h3>Listeners</h3>
<ul>
<li><bugzilla>54589</bugzilla> - View Results Tree have a lot of Garbage characters if html page uses double-byte charset</li>
<li><bugzilla>5473</bugzilla> - StringIndexOutOfBoundsException at SampleResult.getSampleLabel() if key_on_threadname=false when using Statistical mode</li>
</ul>
<h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>