On 21 December 2013 21:56, RL <[email protected]> wrote:
> So the variable exists but contains null, so it has a null length and that
> is why the vars.get() call crashes?

No, the vars.get() call does not crash.
It returns null.

> If that is what's happening it does seem as if it's something which should
> be fixed, I would think.

No, it is working as designed.

Your code needs to be changed to check for null.

>
> On Sat, Dec 21, 2013 at 7:48 AM, sebb <[email protected]> wrote:
>
>> On 21 December 2013 08:09, RL <[email protected]> wrote:
>> > Curious... so what is causing the exception then?
>>
>> null.length()
>>
>> > And why does it not happen if I pre-define the variable from a CVS file?
>> >
>> >
>> >
>> >
>> > On Fri, Dec 20, 2013 at 7:28 PM, sebb <[email protected]> wrote:
>> >
>> >> On 21 December 2013 03:06, RL <[email protected]> wrote:
>> >> >> String blobValue = vars.get("blobValue");
>> >> >
>> >> >>
>> >> >> what does vars.get() return if the variable does not exist?
>> >> >>
>> >> >>
>> >> > Right. That's what's causing the crash.
>> >>
>> >> No, it's not.
>> >>
>> >> > If I create blobValue explicitly beforehand the Beanshell Assertion
>> >> works.
>> >> >
>> >> > So the question more narrowly defined is: how can one test for the
>> >> > existence of a variable before doing a vars.get, since vars.get
>> crashes
>> >> if
>> >> > the specified variable doesn't exist?
>> >>
>> >> Here is the Javadoc:
>> >>
>> >>
>> >>
>> http://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterVariables.html#get%28java.lang.String%29
>> >>
>> >> vars.get() does NOT throw an Exception.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [email protected]
>> >> For additional commands, e-mail: [email protected]
>> >>
>> >>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to