M201370367 / beanshell2

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

Serialization of null and void values is broken #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Null values (and void, I think, too) do not serialize/deserialize correctly. To 
demonstrate, run this code (in Java, not beanshell):
        Interpreter origInterpreter = new Interpreter();
        origInterpreter.eval("myNull = null;");
        ByteArrayOutputStream byteOS = new ByteArrayOutputStream();
        new ObjectOutputStream(byteOS).writeObject(origInterpreter);
        Interpreter serInterperter = (Interpreter)new ObjectInputStream(
                new ByteArrayInputStream(byteOS.toByteArray())).readObject();
        System.out.println("Expected " + origInterpreter.eval("myNull")
                + ", but got " + serInterperter.eval("myNull"));
        System.out.println("Expected " + origInterpreter.eval("myNull == null")
                + ", but got " + serInterperter.eval("myNull == null"));     

The expected output is:
Expected null, got null
Expected true, got true

Instead, the result is:
Expected null, got bsh.Primitive$Special@169e11
Expected true, got false

Original issue reported on code.google.com by jesse...@gmail.com on 16 Aug 2010 at 4:21

Attachments:

GoogleCodeExporter commented 9 years ago
This patch should fix the problem and adds a junit test to verify.

Original comment by jesse...@gmail.com on 24 Aug 2010 at 7:17

Attachments:

GoogleCodeExporter commented 9 years ago
Committed fix to revision 39

Original comment by jesse...@gmail.com on 29 Aug 2010 at 8:05

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by pejob...@gmail.com on 25 Feb 2011 at 5:54

GoogleCodeExporter commented 9 years ago

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