[
https://issues.apache.org/jira/browse/THRIFT-1557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13249455#comment-13249455
]
MXI MXI commented on THRIFT-1557:
---------------------------------
Hi Bryan,
I just called .array(). I don't really use the ByteBuffer and may not
understand it very thoroughly. However, the point here is with the same code,
using TCompactProtocol (Case 1 in my attached code) gives correct result while
TBinaryProtocol (Case 2 in my attached code) injects unexpected leading
characters into the result. One more important thing is it works properly with
client written in Csharp (i.e. using TBinaryProtocol).
> 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
> Labels: features
> Attachments: UnexpectedLeadingCharacters.png.jpg,
> thrift1557_eclipse.zip
>
>
> 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