Using TFramedTransport together with TBinaryProtocol produces unexpected
deserialization for binary in Java
-----------------------------------------------------------------------------------------------------------
Key: THRIFT-1557
URL: https://issues.apache.org/jira/browse/THRIFT-1557
Project: Thrift
Issue Type: Bug
Components: Java - Library
Affects Versions: 0.8, 0.9
Environment: Windows x64, jdk 6u31, libthrift 0.8, 0.9
Reporter: MXI MXI
I create a simple service, called BinService. It has just one method - bin()
which returns a static byte array (ByteBuffer in Java).
#--Here is the service:
namespace java bin
service BinService {
*binary* bin()
}
#---------------------
I tried to test this service in several cases and one gave incorrect result:
- Using THsHaServer, TFramedTransport & *TCompactProtocol* => The result was
correct
- Using THsHaServer, TFramedTransport & *TBinaryProtocol* => The result was
incorrect (unexpected leading characters were injected into the return result)
The amazing thing is when I tried to implement a same client in CSharp, the
result was correct (i.e. using TFramedTransport & *TBinaryProtocol*). By the
way, there is no support for TCompactProtocol in CSharp, using TBinaryProtocol
is a must for this reason.
I wonder whether it is possible to use TFramedTransport with TBinaryProtocol in
Java.
I will attach the code using for reproducing this issue.
N.B. This issue can be seen in both version 0.8 and 0.9.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira