Bug 50178 - HeaderManager added as child of Thread Group can create concatenated HeaderManager names and OutOfMemoryException

git-svn-id: https://svn.apache.org/repos/asf/jakarta/jmeter/trunk@1028948 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2010-10-29 23:49:01 +00:00
parent f6f1dd12a4
commit 3afe57817e
5 changed files with 29 additions and 1 deletions

View File

@ -86,6 +86,15 @@ public abstract class AbstractTestElement implements TestElement, Serializable {
propMap.clear();
}
/**
* {@inheritDoc}
* <p>
* Default implementation - does nothing
*/
public void clearTestElementChildren(){
// NOOP
}
/**
* {@inheritDoc}
*/

View File

@ -37,6 +37,12 @@ public interface TestElement extends Cloneable {
// N.B. Comments originally only applied to Test Plans, hence the name - which can now not be easily changed
public void addTestElement(TestElement child);
/**
* This method should clear any test element properties that are merged
* by {@link #addTestElement(TestElement)}.
*/
public void clearTestElementChildren();
public void setProperty(String key, String value);

View File

@ -240,7 +240,8 @@ public class TestCompiler implements HashTreeTraverser {
private static class ObjectPair
{
private TestElement child, parent;
private final TestElement child;
private final TestElement parent;
public ObjectPair(TestElement one, TestElement two) {
this.child = one;
@ -270,6 +271,7 @@ public class TestCompiler implements HashTreeTraverser {
}
private void configureWithConfigElements(Sampler sam, List<ConfigTestElement> configs) {
sam.clearTestElementChildren();
Iterator<ConfigTestElement> iter = configs.iterator();
while (iter.hasNext()) {
ConfigTestElement config = iter.next();

View File

@ -528,6 +528,16 @@ public abstract class HTTPSamplerBase extends AbstractSampler
}
}
/**
* {@inheritDoc}
* <p>
* Clears the Header Manager property so subsequent loops don't keep merging more elements
*/
@Override
public void clearTestElementChildren(){
removeProperty(HEADER_MANAGER);
}
public void setPort(int value) {
setProperty(new IntegerProperty(PORT, value));
}

View File

@ -68,6 +68,7 @@ To override the default local language fully, set the JMeter property "language"
<h3>HTTP Samplers and Proxy</h3>
<ul>
<li>Bug 50178 - HeaderManager added as child of Thread Group can create concatenated HeaderManager names and OutOfMemoryException</li>
</ul>
<h3>Other Samplers</h3>