You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2015/08/17 13:31:45 UTC

[jira] [Commented] (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=14699387#comment-14699387 ] 

Hudson commented on THRIFT-3293:
--------------------------------

SUCCESS: Integrated in Thrift #1643 (See [https://builds.apache.org/job/Thrift/1643/])
THRIFT-3293 JavaScript: null values turn into empty structs in constructor (henrique: rev 738143cf36436d65c7e379351968e6e0a1f4ca3f)
* compiler/cpp/src/generate/t_js_generator.cc
* lib/nodejs/test/deep-constructor.test.js
* test/JsDeepConstructorTest.thrift


> 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
>             Fix For: 0.9.3
>
>         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)