Adam Zegelin created THRIFT-2773:
------------------------------------
Summary: Generated Java code for 'oneway' methods is incorrect.
Key: THRIFT-2773
URL: https://issues.apache.org/jira/browse/THRIFT-2773
Project: Thrift
Issue Type: Bug
Components: Java - Compiler, Java - Library
Affects Versions: 1.0
Environment: Mac OS X
Reporter: Adam Zegelin
While the ticket THRIFT-2704 (and associated pull request
https://github.com/apache/thrift/pull/216) adds support to Java for 'oneway'
service calls, the changes only apply to the generated AsyncClient.
The synchronous client code calls TServiceClient.sendBase() which always
generates a TMessage of type T_CALL.
{code:title=oneway-test.thrift}
service TestService {
oneway void testFunction();
}
{code}
{code:title=TestService.java|borderStyle=solid}
public static class Client extends org.apache.thrift.TServiceClient
implements Iface {
⋮
public void send_testFunction() throws org.apache.thrift.TException
{
⋮
sendBase("testFunction", args); // note the lack of message type here
}
}
⋮
public static class AsyncClient extends org.apache.thrift.async.TAsyncClient
implements AsyncIface {
⋮
public static class testFunction_call extends
org.apache.thrift.async.TAsyncMethodCall {
⋮
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws
org.apache.thrift.TException {
prot.writeMessageBegin(new
org.apache.thrift.protocol.TMessage("testFunction",
org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); // T_ONEWAY is specified
correctly
testFunction_args args = new testFunction_args();
args.write(prot);
prot.writeMessageEnd();
}
⋮
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)