Shame on me!!!
THANK YOU. I have completely missed it.
On Fri, Mar 4, 2016 at 4:18 PM, Deepak Shetty <[email protected]> wrote:
> Hi
> The Beanshell function itself takes two parameters so characters like ','
> are special and need to be escaped
>
> ${__BeanShell(String s = "abcd asfasd asdfas"; return
> s.substring(3\,4);)}
>
> should work
> http://jmeter.apache.org/usermanual/functions.html
> *If a function parameter contains a comma, then be sure to escape this with
> "\", otherwise JMeter will treat it as a parameter delimiter. For example:
> *
>
> regards
> deepak
>
> On Fri, Mar 4, 2016 at 11:36 AM, Pavel Gouchtchine <[email protected]>
> wrote:
>
> > Hi All,
> > I am using JMeter 2.13 with bsh-2.0b4.jar.
> >
> > A call to String replaceAll, or substring methods within BeanShell
> function
> > does not work. I am getting exception.
> >
> > Here is example:
> > in User Defined Variables I am trying to assign a variable with value
> > ${__BeanShell(String s = "abcd asfasd asdfas"; return
> s.substring(3,4);)}
> > That throws the following exception:
> > 2016/03/04 14:21:25 ERROR - jmeter.util.BeanShellInterpreter: Error
> > invoking bsh method: eval Parse error at line 1, column 54.
> Encountered: (
> > 2016/03/04 14:21:25 WARN - jmeter.functions.BeanShell: Error running BSH
> > script org.apache.jorphan.util.JMeterException: Error invoking bsh
> method:
> > eval Parse error at line 1, column 54. Encountered: (
> > at
> >
> >
> org.apache.jmeter.util.BeanShellInterpreter.bshInvoke(BeanShellInterpreter.java:191)
> > at
> >
> >
> org.apache.jmeter.util.BeanShellInterpreter.eval(BeanShellInterpreter.java:197)
> >
> >
> > Value assignment is working OK if I am using subsring(3):
> > ${__BeanShell(String s = "abcd asfasd asdfas"; return s.substring(3);)}
> >
> >
> > The exception is thrown as well if replaceAll method is called on a
> string
> > object.
> >
> > I have tried bsh-2.0b4.jar and JMeter default bsh-2.0b5.jar.
> >
> > Please help.
> > Pavel Gouchtchine.
> >
>