Bug 55652 - JavaSampler silently resets classname if class can not be found
Summary: JavaSampler silently resets classname if class can not be found
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: Nightly (Please specify date)
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-13 15:59 UTC by Rainer Jung
Modified: 2017-02-07 21:39 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Jung 2013-10-13 15:59:18 UTC
If a custom JavaSampler is used and the class can not be found during JMeter startup, then JMeter silently resets the class name in the JavaSampler to the first (default) class. There's no idication in the GUI about the problem (except if you start looking at the class name drop down) and when you close the test plan, JMeter informs you the test plan has changed and that you should save it. If you save it, then the original class name information is no longer included in the test plan.

I'm not sure what behavior is better, but silently overwriting the class name in the test with the default class name doesn't seem right. Perhaps a warning popup if the class name from the test plan can not be found, keeping the name and either skip the problematic samplers or somehow disable execution of the plan?
Comment 1 Rainer Jung 2013-10-13 16:03:02 UTC
I think the problem happens in JavaConfigGui:

223     public void configure(TestElement config) {
224         super.configure(config);
225
226         argsPanel.configure((Arguments) config.getProperty(JavaSampler.ARGUMENTS).getObjectValue());
227
228         classnameCombo.setSelectedItem(config.getPropertyAsString(JavaSampler.CLASSNAME));
229     }

Since the combo box is not editable, the setSelectedItem() call for a claqss name that wasn't found during load will not change the selected value which by default simply is the first enty in the values list of the combo box.
Comment 2 Philippe Mouawad 2013-10-14 21:51:01 UTC
Date: Mon Oct 14 21:50:26 2013
New Revision: 1532114

URL: http://svn.apache.org/r1532114
Log:
Bug 55652 - JavaSampler silently resets classname if class can not be found
Add as a minimum an error log
Bugzilla Id: 55652

Modified:
    jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/config/gui/JavaConfigGui.java
Comment 3 Philippe Mouawad 2013-10-14 21:51:34 UTC
We could also add an empty item in combo and default to it when not found
Comment 4 Sebb 2013-10-15 14:22:13 UTC
(In reply to Philippe Mouawad from comment #3)
> We could also add an empty item in combo and default to it when not found

I think it would be better to show the desired classname, even if it is not present. Otherwise testplans will potentially be changed if they are run from an environment where the class is missing. However this might be tricky to implement whilst still allowing selection of available classes.

Ideally if the class name is specified in the test plan, it should be shown in the drop-down regardless of whether it exists or not. Maybe the entry could be shown in a different colour if it is missing? The rest of the drop-down would be populated as normal. We'll have to see how that affects behaviour if the selection is changed as this will depend on when the stored value is updated.

If it proves too difficult to implement without being confusing, I agree that using an empty item - or possibly a special 'Missing' item? - would be better than changing to another class name.
Comment 5 Philippe Mouawad 2017-01-24 22:18:30 UTC
Author: pmouawad
Date: Tue Jan 24 22:18:10 2017
New Revision: 1780121

URL: http://svn.apache.org/viewvc?rev=1780121&view=rev
Log:
Bug 55652 - JavaSampler silently resets classname if class can not be found
Bugzilla Id: 55652

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
    jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/config/gui/JavaConfigGui.java
    jmeter/trunk/xdocs/changes.xml
Comment 6 Philippe Mouawad 2017-02-04 20:32:37 UTC
Reopening due to regression:
When Element is added parameters are not set
Comment 7 Philippe Mouawad 2017-02-07 21:39:59 UTC
Author: pmouawad
Date: Tue Feb  7 21:33:49 2017
New Revision: 1782083

URL: http://svn.apache.org/viewvc?rev=1782083&view=rev
Log:
Bug 55652 - JavaSampler silently resets classname if class can not be found
Fix regression: When Element is added parameters are not set and improve warning
Bugzilla Id: 55652

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
    jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/config/gui/JavaConfigGui.java
Comment 8 The ASF infrastructure team 2022-09-24 20:37:55 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3252