You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2013/07/01 12:49:40 UTC

[Bug 55169] New: Unable to use javascipt functions with more than one parameter

https://issues.apache.org/bugzilla/show_bug.cgi?id=55169

            Bug ID: 55169
           Summary: Unable to use javascipt functions with more than one
                    parameter
           Product: JMeter
           Version: 2.9
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
          Assignee: issues@jmeter.apache.org
          Reporter: dlade@web.de

Created attachment 30510
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30510&action=edit
example JMX using Math.max()

When I'm trying to use a javaScript function with more than one parameter (e.g.
${__javaScript(Math.max(2,5))} or with variables
${__javaScript(Math.max(${x},${y}))}), then I get always an exception like:

2013/07/01 12:47:32 ERROR - jmeter.functions.JavaScript: Error processing
Javascript: [Math.max(2]
 org.mozilla.javascript.EvaluatorException: missing ) after argument list
(<cmd>#1)
    at
org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:77)
    at
org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporter.java:64)
    at org.mozilla.javascript.Parser.addError(Parser.java:188)
    at org.mozilla.javascript.Parser.addError(Parser.java:166)
    at org.mozilla.javascript.Parser.reportError(Parser.java:223)
    at org.mozilla.javascript.Parser.reportError(Parser.java:217)
    at org.mozilla.javascript.Parser.mustMatchToken(Parser.java:388)
    at org.mozilla.javascript.Parser.mustMatchToken(Parser.java:378)
    at org.mozilla.javascript.Parser.argumentList(Parser.java:2390)
    at org.mozilla.javascript.Parser.memberExprTail(Parser.java:2523)
    at org.mozilla.javascript.Parser.memberExpr(Parser.java:2442)
    at org.mozilla.javascript.Parser.unaryExpr(Parser.java:2304)
    at org.mozilla.javascript.Parser.mulExpr(Parser.java:2229)
    at org.mozilla.javascript.Parser.addExpr(Parser.java:2213)
    at org.mozilla.javascript.Parser.shiftExpr(Parser.java:2194)
    at org.mozilla.javascript.Parser.relExpr(Parser.java:2169)
    at org.mozilla.javascript.Parser.eqExpr(Parser.java:2141)
    at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:2130)
    at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:2119)
    at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:2108)
    at org.mozilla.javascript.Parser.andExpr(Parser.java:2097)
    at org.mozilla.javascript.Parser.orExpr(Parser.java:2086)
    at org.mozilla.javascript.Parser.condExpr(Parser.java:2062)
    at org.mozilla.javascript.Parser.assignExpr(Parser.java:2033)
    at org.mozilla.javascript.Parser.expr(Parser.java:2012)
    at org.mozilla.javascript.Parser.nameOrLabel(Parser.java:1765)
    at org.mozilla.javascript.Parser.statementHelper(Parser.java:1032)
    at org.mozilla.javascript.Parser.statement(Parser.java:901)
    at org.mozilla.javascript.Parser.parse(Parser.java:540)
    at org.mozilla.javascript.Parser.parse(Parser.java:478)
    at org.mozilla.javascript.Context.compileImpl(Context.java:2348)
    at org.mozilla.javascript.Context.compileString(Context.java:1335)
    at org.mozilla.javascript.Context.compileString(Context.java:1324)
    at org.mozilla.javascript.Context.evaluateString(Context.java:1076)
    at org.apache.jmeter.functions.JavaScript.execute(JavaScript.java:88)
    at
org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:146)
    at
org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:120)
    at
org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:92)
    at
org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:273)
    at org.apache.jmeter.config.Argument.getValue(Argument.java:140)
    at org.apache.jmeter.config.Arguments.getArgumentsAsMap(Arguments.java:93)
    at org.apache.jmeter.engine.PreCompiler.addNode(PreCompiler.java:94)
    at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:1001)
    at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:1002)
    at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:986)
    at
org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:305)
    at java.lang.Thread.run(Unknown Source)

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 55169] Unable to use javascipt functions with more than one parameter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55169

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |p.mouawad@ubik-ingenierie.c
                   |                            |om

--- Comment #3 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
Hello,
The process is :
- ask first on mailing list
- If you do not get answer after a while, you can open a bug


Regarding your issue, you will see it does not seem to be a bug

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 55169] Unable to use javascipt functions with more than one parameter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55169

--- Comment #4 from Danny Lade <dl...@web.de> ---
If someone ever searches the internet for the exception written above here he
will find a solution.

"http://jmeter.apache.org/usermanual/functions.html" writes: 
If a function parameter contains a comma, then be sure to escape this with "\",
otherwise JMeter will treat it as a parameter delimiter.

Because the exception is not mentioned in the document "googling" is not very
useful. But further generations of Google users will find it now ...

JM2C

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 55169] Unable to use javascipt functions with more than one parameter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55169

--- Comment #2 from Danny Lade <dl...@web.de> ---
(In reply to Sebb from comment #1)
> Bugzilla is not a support forum.
> 
> Please subscribe to the JMeter user list and ask there.

What do you mean by "not a support forum"? 
I try to use this function in UserDefinedVariables of JMeter and always get
that exception but the JavaScript-Document says everything is fine.

Therefore something is wrong sending the parameters from JMeter to the
JavaScript-Engine or maybe a bug in this engine.

But how can _I_ decide where the error could be?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 55169] Unable to use javascipt functions with more than one parameter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55169

Sebb <se...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Sebb <se...@apache.org> ---
Bugzilla is not a support forum.

Please subscribe to the JMeter user list and ask there.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 55169] Unable to use javascipt functions with more than one parameter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55169

Danny Lade <dl...@web.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dlade@web.de
                 OS|                            |All

-- 
You are receiving this mail because:
You are the assignee for the bug.