You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jordan (JIRA)" <ji...@apache.org> on 2010/07/10 18:56:53 UTC

[jira] Issue Comment Edited: (THRIFT-815) Deserialization of lists is critically broken.

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

Jordan edited comment on THRIFT-815 at 7/10/10 12:56 PM:
---------------------------------------------------------

Thanks Jake, but I don't think that this works when the things in the list contains objects. 

I changed the testList method to accept a list of LoginResponse objects (that's one of my types) and tried the following code example:
On the server side, it should just return the same list, as before but now the list contains objects. 

  var arr = new Array(); 
  var lr = new TheService.LoginResponse({validCredentials:true, sessionId:"asdf"});                                                                                                                                                           
  arr.push(lr); 
  lr = new TheService.LoginResponse({validCredentials:false, sessionId:"ccc"});
  arr.push(lr);
  lr = new TheService.LoginResponse({validCredentials:false, sessionId:"KKLK"});
  arr.push(lr);
  var ret = client.testList(arr);
  debugger;

What I observe is that I get an empty (everything set to false etc.) first object, the second object is the *last* object of the input list* and everything else is empty (everything set to false/0/etc).


      was (Author: jordo):
    Thanks Jake, but I don't think that this works when the things in the list are objects. 

I changed the testList method to accept a list of LoginResponse objects (that's one of my types) and tried the following code example:
On the server side, it should just return the same list, as before but now the list contains objects. 

  var arr = new Array(); 
  var lr = new TheService.LoginResponse({validCredentials:true, sessionId:"asdf"});                                                                                                                                                           
  arr.push(lr); 
  lr = new TheService.LoginResponse({validCredentials:false, sessionId:"ccc"});
  arr.push(lr);
  lr = new TheService.LoginResponse({validCredentials:false, sessionId:"KKLK"});
  arr.push(lr);
  var ret = client.testList(arr);
  debugger;

What I observe is that I get an empty (everything set to false etc.) first object, the second object is the *last* object of the input list* and everything else is empty (everything set to false/0/etc).

  
> Deserialization of lists is critically broken.
> ----------------------------------------------
>
>                 Key: THRIFT-815
>                 URL: https://issues.apache.org/jira/browse/THRIFT-815
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (JavaScript)
>    Affects Versions: 0.4
>            Reporter: Jordan
>            Assignee: T Jake Luciani
>            Priority: Critical
>             Fix For: 0.4
>
>         Attachments: 813-1.patch
>
>
> Edit the test code that comes with the js language target:
>   var list = [1,2,3]; 
>   var ret = client.testList(list);
>   debugger;
> ret comes back as [3,3,3] when it should be echoed back as [1,2,3]
> The test case never caught this because it only verified the size, and not the contents of the returned array. 
> I cannot find an immediate workaround, but I will try wrapping it in a dummy type like ListServiceResponse. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.