Håkon Hitland created THRIFT-3293:
-------------------------------------
Summary: JavaScript: null values turn into empty structs in
constructor
Key: THRIFT-3293
URL: https://issues.apache.org/jira/browse/THRIFT-3293
Project: Thrift
Issue Type: Bug
Components: JavaScript - Compiler, Node.js - Compiler
Reporter: Håkon Hitland
Given a struct definition with an optional struct field, e.g.
{code}
struct Foo {
1: Bar bar,
}
{code}
Trying to initialize it to a null value like
{code}
new Foo({"bar": null});
{code}
will instead set bar to an empty Bar object.
This happens because the constructor tests for undefined values, but not for
null.
In addition to direct user calls, the internal copyList and copyMap functions
introduced for THRIFT-3122 now often trigger this by initializing one object
from another, making it hard to work around.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)