M201370367 / beanshell2

Automatically exported from code.google.com/p/beanshell2
0 stars 1 forks source link

Using JSR-223, variables assigned a null value remain void #55

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Execute the attached test class

What is the expected output? What do you see instead?
I expect the variables to be "null" whether the script executes directly in the 
interpreter or through the JVM scripting support. What I see instead is that 
when executed through scripting support, even though the variables are 
explicitly assigned "null," they remain "void."

What version of the product are you using? On what operating system?
BeanShell2 build 2.1b4
Debian Squeeze
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

Original issue reported on code.google.com by gunter...@gmail.com on 18 Oct 2011 at 3:51

Attachments:

GoogleCodeExporter commented 9 years ago
The attached patch fixes this issue and does not cause any unit tests to fail 
that aren't already failing.

Original comment by gunter...@gmail.com on 18 Oct 2011 at 7:34

Attachments:

GoogleCodeExporter commented 9 years ago
Scratch that first patch; it feels too much like a hack. I'm attaching a new 
patch that I consider a much better solution.

Original comment by gunter...@gmail.com on 18 Oct 2011 at 9:13

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r94.

Original comment by pejob...@gmail.com on 19 Oct 2011 at 9:47

GoogleCodeExporter commented 9 years ago
@gunter
Could you elaborate on the suggested change in 
"ExternalNameSpace.putExternalMap(String, Object)"? 
I didn't applied this part of the fix.
Test case is green without this change (for test case see r93, 
http://code.google.com/p/beanshell2/source/browse/trunk/tests/junitTests/src/bsh
/Issue_55_Test.java)

Original comment by pejob...@gmail.com on 19 Oct 2011 at 9:55

GoogleCodeExporter commented 9 years ago
The idea behind that change to putExternalMap(..) was that the absence of the 
key indicates void, while the presence of the key mapped to a null value 
indicates null. If an attempt were made to map a name to VOID, that bit of code 
would prevent the name from being added to the map.

Looking at it now, though, I see that VOID assignments should not be possible 
so that particular change should not be necessary. The fix you've applied works 
for me. Thank you!

Original comment by gunter...@gmail.com on 19 Oct 2011 at 12:51

GoogleCodeExporter commented 9 years ago

Original comment by pejob...@gmail.com on 20 Oct 2011 at 7:12

GoogleCodeExporter commented 9 years ago
Issue 60 has been merged into this issue.

Original comment by pejob...@gmail.com on 16 Nov 2011 at 9:26