Bug 60744

Summary: GUI elements are not cleaned up when reused during load of Test Plan which can lead them to be partially initialized with a previous state for a new Test Element
Product: JMeter - Now in Github Reporter: Philippe Mouawad <p.mouawad>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal CC: p.mouawad
Priority: P2    
Version: 2.5   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Test Plan to load and see effect

Description Philippe Mouawad 2017-02-18 16:06:50 UTC
Created attachment 34765 [details]
Test Plan to load and see effect

Hello,
I noticed a strange behaviour of JMeter when you load a Test Plan.

Try loading attached Test plan, you will notice that:
In 3.1, Implementation property of HTTP Request Defaults and HTTP-Request-XXX are in this order : Java, HttpClient3.1, HttpClient4

Open them in nightly build, as HttpClient3.1 has disappeared, you will get:
Java, Java (BUG HERE, you should get ''), HttpClient4


The problem comes from the code:
httpImplementation.setSelectedItem(samplerBase.getPropertyAsString(HTTPSamplerBase.IMPLEMENTATION));

samplerBase.getPropertyAsString(HTTPSamplerBase.IMPLEMENTATION) => Returns HttpClient3.1 so as per setSelectedItem contract:
"If anObject is not in the list and the combo box is uneditable, it will not change the current selection"

So what happens here is that you get the previous "Java" settings.
Note that bug is really tricky as if first node is HttpClient4, then you will get HttpClient 4 instead of Java.


The fix would be here to add a call to clearGUI() in JMeterTreeModel#addComponent before calling guicomp.configure(component):

- https://github.com/apache/jmeter/blob/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java#L146


But I am not sure this cannot have undesired side effects.
Comment 1 Philippe Mouawad 2017-02-18 16:26:28 UTC
Author: pmouawad
Date: Sat Feb 18 16:22:34 2017
New Revision: 1783569

URL: http://svn.apache.org/viewvc?rev=1783569&view=rev
Log:
Bug 60744 - GUI elements are not cleaned up when reused during load of Test Plan which can lead them to be partially initialized with a previous state for a new Test Element
Bugzilla Id: 60744

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java
    jmeter/trunk/xdocs/changes.xml
Comment 2 The ASF infrastructure team 2022-09-24 20:38:07 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4286