You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Håkon Hitland (JIRA)" <ji...@apache.org> on 2015/08/12 19:25:47 UTC
[jira] [Comment Edited] (THRIFT-3293) JavaScript: null values turn
into empty structs in constructor
[ https://issues.apache.org/jira/browse/THRIFT-3293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693884#comment-14693884 ]
Håkon Hitland edited comment on THRIFT-3293 at 8/12/15 5:25 PM:
----------------------------------------------------------------
Attached tests and possible fix
was (Author: hakon):
Tests and possible fix
> 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
> Attachments: thrift-3293-null-init.patch
>
>
> 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)