thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-4266) Erlang library throws during skipping fields of composite type (maps, lists, structs, sets)
Date Thu, 27 Jul 2017 22:29:00 GMT

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

ASF GitHub Bot commented on THRIFT-4266:
----------------------------------------

Github user djnym commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1316#discussion_r129973689
  
    --- Diff: lib/erl/test/test_omit.erl ---
    @@ -0,0 +1,82 @@
    +-module(test_omit).
    +
    +-include("gen-erl/thrift_omit_with_types.hrl").
    +
    +-ifdef(TEST).
    +-include_lib("eunit/include/eunit.hrl").
    +
    +omit_struct1_test() ->
    +  %% In this test, the field that is deleted is a basic type (an i32).
    +  A = #test1{one = 1, three = 3},
    +  B = #test1{one = 1, two = 2, three = 3},
    +  {ok, Transport} = thrift_membuffer_transport:new(),
    +  {ok, P0} = thrift_binary_protocol:new(Transport),
    +
    +  {P1, ok} = thrift_protocol:write(P0, {{struct, {thrift_omit_with_types, element(1,
A)}}, A}),
    +  {P2, {ok, O0}} = thrift_protocol:read(P1, {struct, {thrift_omit_without_types, element(1,
A)}}),
    +  ?assertEqual(element(1, A), element(1, O0)),
    +  ?assertEqual(element(2, A), element(2, O0)),
    +  ?assertEqual(element(4, A), element(3, O0)),
    +
    +  {P3, ok} = thrift_protocol:write(P2, {{struct, {thrift_omit_with_types, element(1,
B)}}, B}),
    +  {_P4, {ok, O1}} = thrift_protocol:read(P3, {struct, {thrift_omit_without_types, element(1,
A)}}),
    +  %% io:format(user, "~p ~p\n", [ A, O1 ]),
    --- End diff --
    
    Probably don't need this commented out line.


> Erlang library throws during skipping fields of composite type (maps, lists, structs,
sets)
> -------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-4266
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4266
>             Project: Thrift
>          Issue Type: Bug
>          Components: Erlang - Library
>    Affects Versions: 0.10.0
>            Reporter: David Hull
>
> I am creating this issue because I am unable to reopen THRIFT-1191.
> The Erlang thrift library throws an error when it attempts skip over an unknown field
when decoding a message.
> The issue is that the second argument of the `thrift_protocol:skip` function must be
an atom, but the calls to the `skip` function in `skip_struct_loop`, skip_map_loop`, skip_set_loop`,
and `skip_list_loop` do not convert the type of the received field header from the integer
form to the atom form.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message