问题
i have thrift service with a function returning list of Object ABC:
struct ABC
{
1: string user_id;
2: string foo;
3: optional list<string> data;
}
list<ABC> getABCByUser(1:required string user_id, 2:i32 limit,3:i32 pageId, 4:string lastDocID)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te)
server side written by c++ I print out result returned by server side, data in ABC instance is NOT null in the response of getABCByUser.
How ever on client side which is written by java: I set break point in the code generated by thrift on java side, data in ABC instance is null, other fields are not null. it looks like a issue on the client side. Any idea how to fix this issue?
thanks in advance!
回答1:
I encounter the same problem with you. I found that if delete the "optional" modifier before list, the return value will be right. But I don't know why we can't use "optional" before list.
回答2:
If you think you may have found a bug, please open a JIRA ticket and add your reproducible test case. This makes it easier for others to have a look at it. Thank you!
来源:https://stackoverflow.com/questions/18052957/regarding-thrift-function-return-list