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
Summary: GUI elements are not cleaned up when reused during load of Test Plan which ca...
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.5
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-18 16:06 UTC by Philippe Mouawad
Modified: 2017-02-18 16:26 UTC (History)
1 user (show)



Attachments
Test Plan to load and see effect (14.15 KB, application/xml)
2017-02-18 16:06 UTC, Philippe Mouawad
Details

Note You need to log in before you can comment on or make changes to this bug.
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