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 2014/08/05 11:21:41 UTC

[Bug 56816] New: vars.get() return void instead of null

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

            Bug ID: 56816
           Summary: vars.get(<non-existing-variable>) return void instead
                    of null
           Product: JMeter
           Version: 2.11
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: Main
          Assignee: issues@jmeter.apache.org
          Reporter: hideemail1@gmail.com

vars.get() returns void in a java script if the variable is not existing
instead of null (as described in it's documentation
http://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterVariables.html#get%28java.lang.String%29
)

This will lead to confusion and bugs if the user doesn't know this.

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

[Bug 56816] vars.get() return void instead of null

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Sebb <se...@apache.org> ---
(In reply to Bernhard from comment #0)
> vars.get() returns void in a java script if the variable is not existing
> instead of null (as described in it's documentation

Are you sure?
I cannot find any references that says that javascript can return void.

> http://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterVariables.
> html#get%28java.lang.String%29 )

That Javadoc is correct; Java returns null (and does not have a concept of void
as a return type)

> This will lead to confusion and bugs if the user doesn't know this.

Possibly, but it's not clear that there is a problem here.

Please provide sample code that exhibits the problem.

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

[Bug 56816] vars.get() return void instead of null

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #3 from Sebb <se...@apache.org> ---
Thanks for the sample JMX.

The code is not Java either - it is BeanShell.
Java does not support void as a value, only as a return type qualifier.
Whereas BeanShell uses void to indicate a non-existent variable.

==

It's not yet clear why assigning null to the variable o should result in it
being void rather than null as expected.

It looks to be a side effect of using the JSR223 sampler rather than the
BeanShell sampler, as the same code works as expected in the BeanShell sampler,
and also works as expected in a Beanshell interpreter or console app.

It remains to be seen whether this is a feature or bug in the JSR223 BeanShell
support in JMeter or in BeanShell.

Meanwhile the workround is to use the BeanShell test elements to run BeanShell
code.

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

[Bug 56816] vars.get() return void instead of null

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

--- Comment #2 from Bernhard <hi...@gmail.com> ---
Created attachment 31880
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31880&action=edit
testplan with bug

Sorry for the confusion, I meant java, not javascript.
I'll add a test plan to make it clear what's wrong.

In the test plan there is a JSR223 with Java which tries to get a nonexistent
variable out of vars. Then there are 2 ifs which compare the nonexistent
variable with null and void and log and add "null" or "void" to the
ResponseMessage.

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

[Bug 56816] vars.get() return void instead of null

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

Bernhard <hi...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hideemail1@gmail.com
                 OS|                            |All

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

[Bug 56816] Assigning null to a BeanShell variable in a JSR223 sampler does not work as expected

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|vars.get(<non-existing-vari |Assigning null to a
                   |able>) return void instead  |BeanShell variable in a
                   |of null                     |JSR223 sampler does not
                   |                            |work as expected

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