thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Tavan (Issue Comment Edited) (JIRA)" <j...@apache.org>
Subject [jira] [Issue Comment Edited] (THRIFT-1277) Node.js serializes false booleans as null
Date Mon, 02 Apr 2012 18:23:24 GMT

    [ https://issues.apache.org/jira/browse/THRIFT-1277?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13244354#comment-13244354
] 

Christoph Tavan edited comment on THRIFT-1277 at 4/2/12 6:22 PM:
-----------------------------------------------------------------

What was wrong with the original patch? As far as I can see all parameters get initialized
to null or some default value in the constructor. The constructor then overwrites these defaults
only if 

{code:javascript}
if (args.varname !== undefined) {
}
{code}

Consequently we cannot get properties that will be undefined. So we cannot have the case mentioned
by Wade. I think we should do strict checking for null.

It would be great if the strict checking patch could be applied again since it will also not
break jslint.

The lack of correct null checking however breaks quite a lot of stuff (like THRIFT-1297).
                
      was (Author: ctavan):
    What was wrong with the original patch? As far as I can see all parameters get initialized
to null or some default value in the constructor. The constructor then overwrites these defaults
only if 

{code:javascript}
if (args.varname !== undefined) {
}
{code}

Consequently we cannot get properties that will be undefined. So we cannot have the case mentioned
by Wade. I think we should do strict checking for null.

It would be great if the strict checking patch could be applied again since it will not break
jslint.

The lack of correct null checking however breaks quite a lot of stuff (like THRIFT-1297).

If anyone's worried that a parameter could somehow get set to undefined we could still use

{code}
out << indent() << "if (this." << (*f_iter)->get_name() << " !==
null && " << endl;
out << indent() << indent() << indent() << "this." << (*f_iter)->get_name()
<< " !== undefined) {" << endl;
{code}

but I can't imagine how that could happen.
                  
> Node.js serializes false booleans as null
> -----------------------------------------
>
>                 Key: THRIFT-1277
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1277
>             Project: Thrift
>          Issue Type: Bug
>          Components: JavaScript - Compiler, Node.js - Compiler
>    Affects Versions: 0.7
>            Reporter: Hans Duedal
>            Assignee: Hans Duedal
>              Labels: compiler, node, nodejs
>             Fix For: 0.9
>
>         Attachments: nodejs_compiler_false_bools.patch, nodejs_compiler_false_bools_loose.patch
>
>
> When serializing boolean types, false booleans are serialized as null instead of false.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message