You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Richard Gaywood <ri...@gmail.com> on 2013/09/03 10:33:08 UTC

String.contains() causes syntax error in BeanShell post-processor

Hi list.

I have a slightly complex test I'm working on where I process a JSON
response. I loop through looking at each value of one particular field,
where the nth value is some string I know I need. Then I want to choose the
nth value of a second field to reuse in the test.

So I have two regex extractors set to match number -1, each grabbing one of
the two  fields, then this in a BSH post-processor:


int i=0;
String subject;
String guid;
do {
subject = vars.get("subjects_"+Integer.toString(i));
guid =  vars.get("pair_guids_"+Integer.toString(i));
i++;
} while (i<5);
//} while (! subject.contains("DESIREDSTRING"));

vars.put("subject", subject );
vars.put("guid", guid );


With the i<5 check (debugging code), it works fine, but obviously doesn't
always grab the correct element. But with the alternative while clause
using String.contains, I get the following error:

2013/09/03 09:30:17 ERROR - jmeter.util.BeanShellInterpreter: Error
invoking bsh method: eval Sourced file: inline evaluation of: `` int i=0;
String subject; String guid; do { subject = vars.get("subjects_"+Inte . . .
''
2013/09/03 09:30:17 WARN  - jmeter.extractor.BeanShellPostProcessor:
Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error
invoking bsh method: eval Sourced file: inline evaluation of: `` int i=0;
String subject; String guid; do { subject = vars.get("subjects_"+Inte . . .
''

I get similar errors on method calls like String.startsWith() too. Can
anyone shed any light on why?

Thanks in advance,

Richard

Re: String.contains() causes syntax error in BeanShell post-processor

Posted by sebb <se...@gmail.com>.
Most likely one of the vars is not being resolved and so you are
getting NPE when using them.

Try adding checks that the vars exist.

On 3 September 2013 12:08, Richard Gaywood <ri...@gmail.com> wrote:
> Hmm. So with that script below (tucked into a .bsh file now), it works fine
> with 1 thread. When I move to 3 threads in the test, it appears to run
> fine, but my jmeter.log fills up with
>
> 2013/09/03 12:04:20 ERROR - jmeter.util.BeanShellInterpreter: Error
> invoking bsh method: source Sourced file: D:\jmeter\tests\script.bsh
> 2013/09/03 12:04:20 WARN  - jmeter.extractor.BeanShellPostProcessor:
> Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error
> invoking bsh method: source Sourced file: D:\jmeter\tests\script.bsh
>
> I see similar errors if I pull the script back inline
>
> 2013/09/03 12:06:47 ERROR - jmeter.util.BeanShellInterpreter: Error
> invoking bsh method: eval Sourced file: inline evaluation of: ``String
> subject = vars.get("subjects_2"); if (subject.contains("SubmitXmlOnSessio .
> . . ''
> 2013/09/03 12:06:47 WARN  - jmeter.extractor.BeanShellPostProcessor:
> Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error
> invoking bsh method: eval Sourced file: inline evaluation of: ``String
> subject = vars.get("subjects_2"); if (subject.contains("SubmitXmlOnSessio .
> . . ''
>
> What's that all about? As I said, I see no errors if I just run with one
> thread. I've tried "reset interpreter" set to both "true" and "false", it
> doesn't change anything.
>
>
>
> On Tue, Sep 3, 2013 at 11:53 AM, Richard Gaywood
> <ri...@gmail.com>wrote:
>
>> I've already tried the building up thing -- it was only the addition of
>> the last line, the string.contains() one, that provoked the error.
>>
>> I've come up with a (rather ugly) workaround now -- no idea why this works
>> when the do...while version didn't, though.
>>
>> String subject = vars.get("subjects_3");
>>> if (subject.contains("SubmitXmlOnSession")) {
>>>
>>> vars.put("subject", subject );
>>> vars.put("guid", vars.get("pair_guids_3" ));
>>> }
>>> subject = vars.get("subjects_4");
>>> if (subject.contains("SubmitXmlOnSession")) {
>>>
>>> vars.put("subject", subject );
>>> vars.put("guid", vars.get("pair_guids_4" ));
>>> }
>>> subject = vars.get("subjects_5");
>>> if (subject.contains("SubmitXmlOnSession")) {
>>>
>>> vars.put("subject", subject );
>>> vars.put("guid", vars.get("pair_guids_5" ));
>>> }
>>> subject = vars.get("subjects_6");
>>> if (subject.contains("SubmitXmlOnSession")) {
>>>
>>> vars.put("subject", subject );
>>> vars.put("guid", vars.get("pair_guids_6" ));
>>> }
>>
>>
>>
>> On Tue, Sep 3, 2013 at 11:23 AM, sebb <se...@gmail.com> wrote:
>>
>>> On 3 September 2013 11:03, Richard Gaywood <ri...@gmail.com>
>>> wrote:
>>> > Further to the below, I've written the below script which I've run
>>> through
>>> > the beanshell interpreter myself with java bsh.Interpreter test.bsh,
>>> and it
>>> > works.
>>> >
>>> > Script:
>>> >
>>> > String foo = "foo";
>>> >> String bar = "bar";
>>> >> if (foo.contains("o")) {
>>> >> System.out.println(foo);
>>> >> }
>>> >> if (bar.contains("o")) {
>>> >> System.out.println(bar);
>>> >> }
>>> >>
>>> >> int i=0;
>>> >> String subject;
>>> >> String guid;
>>> >> do {
>>> >> subject = "foo DESIREDTEXT"+Integer.toString(i);
>>> >> guid =  "guid"+Integer.toString(i);
>>> >> i++;
>>> >> } while (! subject.contains("DESIREDTEXT3"));
>>> >> System.out.println(guid);
>>> >
>>> >
>>> >
>>> > Output:
>>> >
>>> > foo
>>> >> guid3
>>> >
>>> >
>>> >
>>> > So the BSH itself looks OK to me, can't figure out why JMeter doesn't
>>> like
>>> > it...
>>>
>>> Most likely cause is an unexpected quoting or variable replacement
>>> issue so BSH does not get passed what you expect.
>>>
>>> Try putting the script in a file.
>>>
>>> And/or try the problematic statement on its own, and gradually build
>>> up the rest of the script.
>>> You can do that by selective commenting of lines with //
>>>
>>> >
>>> >
>>> > On Tue, Sep 3, 2013 at 9:33 AM, Richard Gaywood <
>>> richardgaywood@gmail.com>wrote:
>>> >
>>> >> Hi list.
>>> >>
>>> >> I have a slightly complex test I'm working on where I process a JSON
>>> >> response. I loop through looking at each value of one particular field,
>>> >> where the nth value is some string I know I need. Then I want to
>>> choose the
>>> >> nth value of a second field to reuse in the test.
>>> >>
>>> >> So I have two regex extractors set to match number -1, each grabbing
>>> one
>>> >> of the two  fields, then this in a BSH post-processor:
>>> >>
>>> >>
>>> >> int i=0;
>>> >> String subject;
>>> >> String guid;
>>> >> do {
>>> >> subject = vars.get("subjects_"+Integer.toString(i));
>>> >> guid =  vars.get("pair_guids_"+Integer.toString(i));
>>> >>  i++;
>>> >> } while (i<5);
>>> >> //} while (! subject.contains("DESIREDSTRING"));
>>> >>
>>> >> vars.put("subject", subject );
>>> >> vars.put("guid", guid );
>>> >>
>>> >>
>>> >> With the i<5 check (debugging code), it works fine, but obviously
>>> doesn't
>>> >> always grab the correct element. But with the alternative while clause
>>> >> using String.contains, I get the following error:
>>> >>
>>> >> 2013/09/03 09:30:17 ERROR - jmeter.util.BeanShellInterpreter: Error
>>> >> invoking bsh method: eval Sourced file: inline evaluation of: `` int
>>> i=0;
>>> >> String subject; String guid; do { subject = vars.get("subjects_"+Inte
>>> . .
>>> >> . ''
>>> >> 2013/09/03 09:30:17 WARN  - jmeter.extractor.BeanShellPostProcessor:
>>> >> Problem in BeanShell script org.apache.jorphan.util.JMeterException:
>>> Error
>>> >> invoking bsh method: eval Sourced file: inline evaluation of: `` int
>>> i=0;
>>> >> String subject; String guid; do { subject = vars.get("subjects_"+Inte
>>> . .
>>> >> . ''
>>> >>
>>> >> I get similar errors on method calls like String.startsWith() too. Can
>>> >> anyone shed any light on why?
>>> >>
>>> >> Thanks in advance,
>>> >>
>>> >> Richard
>>> >>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>>> For additional commands, e-mail: user-help@jmeter.apache.org
>>>
>>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Re: String.contains() causes syntax error in BeanShell post-processor

Posted by Richard Gaywood <ri...@gmail.com>.
Hmm. So with that script below (tucked into a .bsh file now), it works fine
with 1 thread. When I move to 3 threads in the test, it appears to run
fine, but my jmeter.log fills up with

2013/09/03 12:04:20 ERROR - jmeter.util.BeanShellInterpreter: Error
invoking bsh method: source Sourced file: D:\jmeter\tests\script.bsh
2013/09/03 12:04:20 WARN  - jmeter.extractor.BeanShellPostProcessor:
Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error
invoking bsh method: source Sourced file: D:\jmeter\tests\script.bsh

I see similar errors if I pull the script back inline

2013/09/03 12:06:47 ERROR - jmeter.util.BeanShellInterpreter: Error
invoking bsh method: eval Sourced file: inline evaluation of: ``String
subject = vars.get("subjects_2"); if (subject.contains("SubmitXmlOnSessio .
. . ''
2013/09/03 12:06:47 WARN  - jmeter.extractor.BeanShellPostProcessor:
Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error
invoking bsh method: eval Sourced file: inline evaluation of: ``String
subject = vars.get("subjects_2"); if (subject.contains("SubmitXmlOnSessio .
. . ''

What's that all about? As I said, I see no errors if I just run with one
thread. I've tried "reset interpreter" set to both "true" and "false", it
doesn't change anything.



On Tue, Sep 3, 2013 at 11:53 AM, Richard Gaywood
<ri...@gmail.com>wrote:

> I've already tried the building up thing -- it was only the addition of
> the last line, the string.contains() one, that provoked the error.
>
> I've come up with a (rather ugly) workaround now -- no idea why this works
> when the do...while version didn't, though.
>
> String subject = vars.get("subjects_3");
>> if (subject.contains("SubmitXmlOnSession")) {
>>
>> vars.put("subject", subject );
>> vars.put("guid", vars.get("pair_guids_3" ));
>> }
>> subject = vars.get("subjects_4");
>> if (subject.contains("SubmitXmlOnSession")) {
>>
>> vars.put("subject", subject );
>> vars.put("guid", vars.get("pair_guids_4" ));
>> }
>> subject = vars.get("subjects_5");
>> if (subject.contains("SubmitXmlOnSession")) {
>>
>> vars.put("subject", subject );
>> vars.put("guid", vars.get("pair_guids_5" ));
>> }
>> subject = vars.get("subjects_6");
>> if (subject.contains("SubmitXmlOnSession")) {
>>
>> vars.put("subject", subject );
>> vars.put("guid", vars.get("pair_guids_6" ));
>> }
>
>
>
> On Tue, Sep 3, 2013 at 11:23 AM, sebb <se...@gmail.com> wrote:
>
>> On 3 September 2013 11:03, Richard Gaywood <ri...@gmail.com>
>> wrote:
>> > Further to the below, I've written the below script which I've run
>> through
>> > the beanshell interpreter myself with java bsh.Interpreter test.bsh,
>> and it
>> > works.
>> >
>> > Script:
>> >
>> > String foo = "foo";
>> >> String bar = "bar";
>> >> if (foo.contains("o")) {
>> >> System.out.println(foo);
>> >> }
>> >> if (bar.contains("o")) {
>> >> System.out.println(bar);
>> >> }
>> >>
>> >> int i=0;
>> >> String subject;
>> >> String guid;
>> >> do {
>> >> subject = "foo DESIREDTEXT"+Integer.toString(i);
>> >> guid =  "guid"+Integer.toString(i);
>> >> i++;
>> >> } while (! subject.contains("DESIREDTEXT3"));
>> >> System.out.println(guid);
>> >
>> >
>> >
>> > Output:
>> >
>> > foo
>> >> guid3
>> >
>> >
>> >
>> > So the BSH itself looks OK to me, can't figure out why JMeter doesn't
>> like
>> > it...
>>
>> Most likely cause is an unexpected quoting or variable replacement
>> issue so BSH does not get passed what you expect.
>>
>> Try putting the script in a file.
>>
>> And/or try the problematic statement on its own, and gradually build
>> up the rest of the script.
>> You can do that by selective commenting of lines with //
>>
>> >
>> >
>> > On Tue, Sep 3, 2013 at 9:33 AM, Richard Gaywood <
>> richardgaywood@gmail.com>wrote:
>> >
>> >> Hi list.
>> >>
>> >> I have a slightly complex test I'm working on where I process a JSON
>> >> response. I loop through looking at each value of one particular field,
>> >> where the nth value is some string I know I need. Then I want to
>> choose the
>> >> nth value of a second field to reuse in the test.
>> >>
>> >> So I have two regex extractors set to match number -1, each grabbing
>> one
>> >> of the two  fields, then this in a BSH post-processor:
>> >>
>> >>
>> >> int i=0;
>> >> String subject;
>> >> String guid;
>> >> do {
>> >> subject = vars.get("subjects_"+Integer.toString(i));
>> >> guid =  vars.get("pair_guids_"+Integer.toString(i));
>> >>  i++;
>> >> } while (i<5);
>> >> //} while (! subject.contains("DESIREDSTRING"));
>> >>
>> >> vars.put("subject", subject );
>> >> vars.put("guid", guid );
>> >>
>> >>
>> >> With the i<5 check (debugging code), it works fine, but obviously
>> doesn't
>> >> always grab the correct element. But with the alternative while clause
>> >> using String.contains, I get the following error:
>> >>
>> >> 2013/09/03 09:30:17 ERROR - jmeter.util.BeanShellInterpreter: Error
>> >> invoking bsh method: eval Sourced file: inline evaluation of: `` int
>> i=0;
>> >> String subject; String guid; do { subject = vars.get("subjects_"+Inte
>> . .
>> >> . ''
>> >> 2013/09/03 09:30:17 WARN  - jmeter.extractor.BeanShellPostProcessor:
>> >> Problem in BeanShell script org.apache.jorphan.util.JMeterException:
>> Error
>> >> invoking bsh method: eval Sourced file: inline evaluation of: `` int
>> i=0;
>> >> String subject; String guid; do { subject = vars.get("subjects_"+Inte
>> . .
>> >> . ''
>> >>
>> >> I get similar errors on method calls like String.startsWith() too. Can
>> >> anyone shed any light on why?
>> >>
>> >> Thanks in advance,
>> >>
>> >> Richard
>> >>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> For additional commands, e-mail: user-help@jmeter.apache.org
>>
>>
>

Re: String.contains() causes syntax error in BeanShell post-processor

Posted by Richard Gaywood <ri...@gmail.com>.
I've already tried the building up thing -- it was only the addition of the
last line, the string.contains() one, that provoked the error.

I've come up with a (rather ugly) workaround now -- no idea why this works
when the do...while version didn't, though.

String subject = vars.get("subjects_3");
> if (subject.contains("SubmitXmlOnSession")) {
> vars.put("subject", subject );
> vars.put("guid", vars.get("pair_guids_3" ));
> }
> subject = vars.get("subjects_4");
> if (subject.contains("SubmitXmlOnSession")) {
> vars.put("subject", subject );
> vars.put("guid", vars.get("pair_guids_4" ));
> }
> subject = vars.get("subjects_5");
> if (subject.contains("SubmitXmlOnSession")) {
> vars.put("subject", subject );
> vars.put("guid", vars.get("pair_guids_5" ));
> }
> subject = vars.get("subjects_6");
> if (subject.contains("SubmitXmlOnSession")) {
> vars.put("subject", subject );
> vars.put("guid", vars.get("pair_guids_6" ));
> }



On Tue, Sep 3, 2013 at 11:23 AM, sebb <se...@gmail.com> wrote:

> On 3 September 2013 11:03, Richard Gaywood <ri...@gmail.com>
> wrote:
> > Further to the below, I've written the below script which I've run
> through
> > the beanshell interpreter myself with java bsh.Interpreter test.bsh, and
> it
> > works.
> >
> > Script:
> >
> > String foo = "foo";
> >> String bar = "bar";
> >> if (foo.contains("o")) {
> >> System.out.println(foo);
> >> }
> >> if (bar.contains("o")) {
> >> System.out.println(bar);
> >> }
> >>
> >> int i=0;
> >> String subject;
> >> String guid;
> >> do {
> >> subject = "foo DESIREDTEXT"+Integer.toString(i);
> >> guid =  "guid"+Integer.toString(i);
> >> i++;
> >> } while (! subject.contains("DESIREDTEXT3"));
> >> System.out.println(guid);
> >
> >
> >
> > Output:
> >
> > foo
> >> guid3
> >
> >
> >
> > So the BSH itself looks OK to me, can't figure out why JMeter doesn't
> like
> > it...
>
> Most likely cause is an unexpected quoting or variable replacement
> issue so BSH does not get passed what you expect.
>
> Try putting the script in a file.
>
> And/or try the problematic statement on its own, and gradually build
> up the rest of the script.
> You can do that by selective commenting of lines with //
>
> >
> >
> > On Tue, Sep 3, 2013 at 9:33 AM, Richard Gaywood <
> richardgaywood@gmail.com>wrote:
> >
> >> Hi list.
> >>
> >> I have a slightly complex test I'm working on where I process a JSON
> >> response. I loop through looking at each value of one particular field,
> >> where the nth value is some string I know I need. Then I want to choose
> the
> >> nth value of a second field to reuse in the test.
> >>
> >> So I have two regex extractors set to match number -1, each grabbing one
> >> of the two  fields, then this in a BSH post-processor:
> >>
> >>
> >> int i=0;
> >> String subject;
> >> String guid;
> >> do {
> >> subject = vars.get("subjects_"+Integer.toString(i));
> >> guid =  vars.get("pair_guids_"+Integer.toString(i));
> >>  i++;
> >> } while (i<5);
> >> //} while (! subject.contains("DESIREDSTRING"));
> >>
> >> vars.put("subject", subject );
> >> vars.put("guid", guid );
> >>
> >>
> >> With the i<5 check (debugging code), it works fine, but obviously
> doesn't
> >> always grab the correct element. But with the alternative while clause
> >> using String.contains, I get the following error:
> >>
> >> 2013/09/03 09:30:17 ERROR - jmeter.util.BeanShellInterpreter: Error
> >> invoking bsh method: eval Sourced file: inline evaluation of: `` int
> i=0;
> >> String subject; String guid; do { subject = vars.get("subjects_"+Inte .
> .
> >> . ''
> >> 2013/09/03 09:30:17 WARN  - jmeter.extractor.BeanShellPostProcessor:
> >> Problem in BeanShell script org.apache.jorphan.util.JMeterException:
> Error
> >> invoking bsh method: eval Sourced file: inline evaluation of: `` int
> i=0;
> >> String subject; String guid; do { subject = vars.get("subjects_"+Inte .
> .
> >> . ''
> >>
> >> I get similar errors on method calls like String.startsWith() too. Can
> >> anyone shed any light on why?
> >>
> >> Thanks in advance,
> >>
> >> Richard
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

Re: String.contains() causes syntax error in BeanShell post-processor

Posted by sebb <se...@gmail.com>.
On 3 September 2013 11:03, Richard Gaywood <ri...@gmail.com> wrote:
> Further to the below, I've written the below script which I've run through
> the beanshell interpreter myself with java bsh.Interpreter test.bsh, and it
> works.
>
> Script:
>
> String foo = "foo";
>> String bar = "bar";
>> if (foo.contains("o")) {
>> System.out.println(foo);
>> }
>> if (bar.contains("o")) {
>> System.out.println(bar);
>> }
>>
>> int i=0;
>> String subject;
>> String guid;
>> do {
>> subject = "foo DESIREDTEXT"+Integer.toString(i);
>> guid =  "guid"+Integer.toString(i);
>> i++;
>> } while (! subject.contains("DESIREDTEXT3"));
>> System.out.println(guid);
>
>
>
> Output:
>
> foo
>> guid3
>
>
>
> So the BSH itself looks OK to me, can't figure out why JMeter doesn't like
> it...

Most likely cause is an unexpected quoting or variable replacement
issue so BSH does not get passed what you expect.

Try putting the script in a file.

And/or try the problematic statement on its own, and gradually build
up the rest of the script.
You can do that by selective commenting of lines with //

>
>
> On Tue, Sep 3, 2013 at 9:33 AM, Richard Gaywood <ri...@gmail.com>wrote:
>
>> Hi list.
>>
>> I have a slightly complex test I'm working on where I process a JSON
>> response. I loop through looking at each value of one particular field,
>> where the nth value is some string I know I need. Then I want to choose the
>> nth value of a second field to reuse in the test.
>>
>> So I have two regex extractors set to match number -1, each grabbing one
>> of the two  fields, then this in a BSH post-processor:
>>
>>
>> int i=0;
>> String subject;
>> String guid;
>> do {
>> subject = vars.get("subjects_"+Integer.toString(i));
>> guid =  vars.get("pair_guids_"+Integer.toString(i));
>>  i++;
>> } while (i<5);
>> //} while (! subject.contains("DESIREDSTRING"));
>>
>> vars.put("subject", subject );
>> vars.put("guid", guid );
>>
>>
>> With the i<5 check (debugging code), it works fine, but obviously doesn't
>> always grab the correct element. But with the alternative while clause
>> using String.contains, I get the following error:
>>
>> 2013/09/03 09:30:17 ERROR - jmeter.util.BeanShellInterpreter: Error
>> invoking bsh method: eval Sourced file: inline evaluation of: `` int i=0;
>> String subject; String guid; do { subject = vars.get("subjects_"+Inte . .
>> . ''
>> 2013/09/03 09:30:17 WARN  - jmeter.extractor.BeanShellPostProcessor:
>> Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error
>> invoking bsh method: eval Sourced file: inline evaluation of: `` int i=0;
>> String subject; String guid; do { subject = vars.get("subjects_"+Inte . .
>> . ''
>>
>> I get similar errors on method calls like String.startsWith() too. Can
>> anyone shed any light on why?
>>
>> Thanks in advance,
>>
>> Richard
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Re: String.contains() causes syntax error in BeanShell post-processor

Posted by Richard Gaywood <ri...@gmail.com>.
Further to the below, I've written the below script which I've run through
the beanshell interpreter myself with java bsh.Interpreter test.bsh, and it
works.

Script:

String foo = "foo";
> String bar = "bar";
> if (foo.contains("o")) {
> System.out.println(foo);
> }
> if (bar.contains("o")) {
> System.out.println(bar);
> }
>
> int i=0;
> String subject;
> String guid;
> do {
> subject = "foo DESIREDTEXT"+Integer.toString(i);
> guid =  "guid"+Integer.toString(i);
> i++;
> } while (! subject.contains("DESIREDTEXT3"));
> System.out.println(guid);



Output:

foo
> guid3



So the BSH itself looks OK to me, can't figure out why JMeter doesn't like
it...



On Tue, Sep 3, 2013 at 9:33 AM, Richard Gaywood <ri...@gmail.com>wrote:

> Hi list.
>
> I have a slightly complex test I'm working on where I process a JSON
> response. I loop through looking at each value of one particular field,
> where the nth value is some string I know I need. Then I want to choose the
> nth value of a second field to reuse in the test.
>
> So I have two regex extractors set to match number -1, each grabbing one
> of the two  fields, then this in a BSH post-processor:
>
>
> int i=0;
> String subject;
> String guid;
> do {
> subject = vars.get("subjects_"+Integer.toString(i));
> guid =  vars.get("pair_guids_"+Integer.toString(i));
>  i++;
> } while (i<5);
> //} while (! subject.contains("DESIREDSTRING"));
>
> vars.put("subject", subject );
> vars.put("guid", guid );
>
>
> With the i<5 check (debugging code), it works fine, but obviously doesn't
> always grab the correct element. But with the alternative while clause
> using String.contains, I get the following error:
>
> 2013/09/03 09:30:17 ERROR - jmeter.util.BeanShellInterpreter: Error
> invoking bsh method: eval Sourced file: inline evaluation of: `` int i=0;
> String subject; String guid; do { subject = vars.get("subjects_"+Inte . .
> . ''
> 2013/09/03 09:30:17 WARN  - jmeter.extractor.BeanShellPostProcessor:
> Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error
> invoking bsh method: eval Sourced file: inline evaluation of: `` int i=0;
> String subject; String guid; do { subject = vars.get("subjects_"+Inte . .
> . ''
>
> I get similar errors on method calls like String.startsWith() too. Can
> anyone shed any light on why?
>
> Thanks in advance,
>
> Richard
>