Bug 61659 - JMeterVariables#get() should apply toString() on non string objects
Summary: JMeterVariables#get() should apply toString() on non string objects
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 3.3
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-24 10:58 UTC by Philippe Mouawad
Modified: 2017-10-24 11:08 UTC (History)
1 user (show)



Attachments
Test plan failing (5.05 KB, application/xml)
2017-10-24 10:58 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-10-24 10:58:08 UTC
Created attachment 35451 [details]
Test plan failing

Currently, whenever you store in a variable non string object using
vars.putObject("nbLoops", 1)

and getting it as ${"nbLoops"} in a LoopController for example will fail due to ClassCastException and a log will appear:
> java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

I feel this could be improved by calling toString() on variable value if it's not a String.
Comment 1 Philippe Mouawad 2017-10-24 11:08:06 UTC
Author: pmouawad
Date: Tue Oct 24 11:02:25 2017
New Revision: 1813168

URL: http://svn.apache.org/viewvc?rev=1813168&view=rev
Log:
Bug 61659 - JMeterVariables#get() should apply toString() on non string objects
Bugzilla Id: 61659

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