Author: fschumacher
Date: Tue Jan 22 20:56:10 2019
New Revision: 1851864

URL: http://svn.apache.org/viewvc?rev=1851864&view=rev
Log:
Escape commata in function helper dialog only outside of variable replacement 
structures.

Correct detection of an escaped $ and fix checkstyle error, while we are here.

Bugzilla Id: 63099

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java
    
jmeter/trunk/test/src/org/apache/jmeter/functions/gui/FunctionHelperSpec.groovy

Modified: 
jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java?rev=1851864&r1=1851863&r2=1851864&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java 
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java 
Tue Jan 22 20:56:10 2019
@@ -280,15 +280,19 @@ public class FunctionHelper extends JDia
             while ((c = r.read()) != -1) {
                 char nextChar = (char) c;
                 if (lastChar == '\\') {
-                    // do nothing
+                    lastChar = ANY_NORMAL_CHAR;
                 } else if (lastChar == '$' && nextChar == '{') {
                     level++;
+                    lastChar = ANY_NORMAL_CHAR;
                 } else if (nextChar == '}') {
                     level--;
+                    lastChar = ANY_NORMAL_CHAR;
                 } else if (nextChar == ',' && level == 0) {
                     result.append('\\');
+                    lastChar = ANY_NORMAL_CHAR;
+                } else {
+                    lastChar = nextChar;
                 }
-                lastChar = nextChar;
                 result.append(nextChar);
             }
         } catch (IOException e) {

Modified: 
jmeter/trunk/test/src/org/apache/jmeter/functions/gui/FunctionHelperSpec.groovy
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/gui/FunctionHelperSpec.groovy?rev=1851864&r1=1851863&r2=1851864&view=diff
==============================================================================
--- 
jmeter/trunk/test/src/org/apache/jmeter/functions/gui/FunctionHelperSpec.groovy 
(original)
+++ 
jmeter/trunk/test/src/org/apache/jmeter/functions/gui/FunctionHelperSpec.groovy 
Tue Jan 22 20:56:10 2019
@@ -47,6 +47,7 @@ class FunctionHelperSpec extends JMeterS
           "fname"      | ["a,b,c"]     | "\${fname(a\\,b\\,c)}"
           "fname"      | ["a", "b"]    | "\${fname(a,b)}"
           "fname"      | ["a,b", "c"]  | "\${fname(a\\,b,c)}"
+          "fname"      | ["\\\${f(a,b)}"]                  | 
"\${fname(\\\${f(a\\,b)})}"
           "fname"      | ["\${f(a,b)},c,\${g(d,e)}","h"]   | 
"\${fname(\${f(a,b)}\\,c\\,\${g(d,e)},h)}"
           "fname"      | ["a,\${f(b,\${g(c,d)},e)},f","h"] | 
"\${fname(a\\,\${f(b,\${g(c,d)},e)}\\,f,h)}"
     }


Reply via email to