You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2017/10/24 11:02:25 UTC

svn commit: r1813168 - in /jmeter/trunk: src/core/org/apache/jmeter/threads/JMeterVariables.java xdocs/changes.xml

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

Modified: jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterVariables.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterVariables.java?rev=1813168&r1=1813167&r2=1813168&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterVariables.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterVariables.java Tue Oct 24 11:02:25 2017
@@ -129,13 +129,20 @@ public class JMeterVariables {
     }
 
     /**
-     * Gets the value of a variable, coerced to a String.
+     * Gets the value of a variable, converted to a String.
      * 
      * @param key the name of the variable
-     * @return the value of the variable, or {@code null} if it does not exist
+     * @return the value of the variable or a toString called on it if it's non String, or {@code null} if it does not exist
      */
     public String get(String key) {
-        return (String) variables.get(key);
+        Object o = variables.get(key);
+        if(o instanceof String) {
+            return (String) o;
+        } else if (o != null) {
+            return o.toString();
+        } else {
+            return null;
+        }
     }
 
     /**

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1813168&r1=1813167&r2=1813168&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Tue Oct 24 11:02:25 2017
@@ -135,6 +135,7 @@ Summary
     <li><bug>61629</bug>Add Think Times to Children menu should not consider disabled elements</li>
     <li><bug>61655</bug>SampleSender : Drop HoldSampleSender implementation</li>
     <li><bug>61656</bug><code>tearDown Thread Group</code> should run by default at stop or shutdown of test</li>
+    <li><bug>61659</bug>JMeterVariables#get() should apply toString() on non string objects</li>
 </ul>
 
 <ch_section>Non-functional changes</ch_section>