Radoslaw Gruchalski created THRIFT-2923:
-------------------------------------------

             Summary: JavaScript client assumes a message being written
                 Key: THRIFT-2923
                 URL: https://issues.apache.org/jira/browse/THRIFT-2923
             Project: Thrift
          Issue Type: Bug
          Components: JavaScript - Library
    Affects Versions: 0.9.2
            Reporter: Radoslaw Gruchalski
            Priority: Minor


I am working on a solution which uses Thrift directly, without embedded RPC 
framework, it's sending messages via UDP. Currently being integrated into 
Chrome Extension and I found a bug when doing the following:

{noformat}
var transport = new Thrift.TWebSocketTransport("http://dummy";);
var protocol  = new Thrift.Protocol( transport );
digest.write( protocol );
{noformat}

The error is:

{noformat}
Cannot read property 'push' of undefined.
{noformat}

The reason for this behaviour is:

digest.write calls protocol.writeStructBegin which uses 
this.tpos.push(this.tstack.length) in 
https://github.com/apache/thrift/blob/master/lib/js/src/thrift.js#L778 but tpos 
and tstack aren't defined unless writeMessageBegin is called in 
https://github.com/apache/thrift/blob/master/lib/js/src/thrift.js#L751.

Expected behaviour:

tstack and tpos should be defined in the Protocol "constructor", here: 
https://github.com/apache/thrift/blob/master/lib/js/src/thrift.js#L687.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to