You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by ZK <st...@gmail.com> on 2011/09/23 09:08:51 UTC

Re: Bean Shell Preprocessor query

bshFoo = (vars.get("Foo"));
bshFoo = "Four";
vars.put("Foo", ""+bshFoo);



ZK

--
View this message in context: http://jmeter.512774.n5.nabble.com/Bean-Shell-Preprocessor-query-tp4831233p4832617.html
Sent from the JMeter - User mailing list archive at Nabble.com.

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


Re: Bean Shell Preprocessor query

Posted by Bruce Ide <fl...@gmail.com>.
Heh, I'm a programmer. I have to admit though, that I very rarely check my
return value for null after vars.get. I figure if my BSF sampler fails with
a null pointer exception, I should know what's going on. Using "" + for
string conversion is probably a little less efficient than
Long.toString(variable), since you're creating some extra temporary strings
that you'll have to garbage collect later on. It probably wouldn't make a
measurable difference in your test, unless you looped through doing it a few
thousand times or using a multi-megabyte String. A system I used to work on
would store 30+ megabyte Strings on a regular basis. You definitely don't
want to create any more copies of those than you have to!

-- 
Bruce Ide
FlyingRhenquest@gmail.com

Re: Bean Shell Preprocessor query

Posted by ZK <st...@gmail.com>.
Yes you are correct! ;)
However my mindset is to FORCE it to be string (even though it already is)
belt and braces :)

I'm an atheist


ZK

--
View this message in context: http://jmeter.512774.n5.nabble.com/Bean-Shell-Preprocessor-query-tp4831233p4832808.html
Sent from the JMeter - User mailing list archive at Nabble.com.

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


Re: Bean Shell Preprocessor query

Posted by Bruce Ide <fl...@gmail.com>.
You don't need to use ""+ to convert bshFoo into a String! It's already a
String! And using ""+ to convert something to a String is the wrong way to
do that, anyway!

God!

;-)

-- 
Bruce Ide
FlyingRhenquest@gmail.com