[
https://issues.apache.org/jira/browse/THRIFT-772?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014812#comment-13014812
]
Jeff Whiting commented on THRIFT-772:
-------------------------------------
This bug seems like a big problem. We have two thrift objects that are the
same but when you call o1.equals(o2) it returns false because the
__isset_bit_vector state is different. We tried the work around of putting
"optional" but it didn't do anything. We even tried "required" but it didn't
change it.
We are trying to use equals (or compareTo) in a unit test for one our thrift
services. So we do:
ThriftObj o1 = new ThriftObj();
o1.setBooleanValue(true);
client.sendThriftObject(o1);
ThriftObj o2 = client.getThriftObject();
assert( o1.equals(o2) );
And the assert fails because the __isset_bit_vector is different even though
ALL of the values are identical. Why even bother with an equals and a compareTo
if it wont return true for thrift objects that have the the same values?
> __isset_bit_vector state before serialization differs from state after
> unserialization on native field
> ------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-772
> URL: https://issues.apache.org/jira/browse/THRIFT-772
> Project: Thrift
> Issue Type: Bug
> Components: Java - Library
> Affects Versions: 0.2
> Environment: Linux, thrift release 0.2.0 with patch Thrift-746 and
> Thrift-663
> Reporter: david herviou
> Labels: serialization
> Attachments: thrift-issue-bitset-nativefields.tgz
>
>
> Once java classes have been generated it is possible to test if the fields
> have been set or not using the method isSetXXX().
> Once one of this java class is instanciated, all call to field.isSetXXX() are
> returning false which is a good thing (this method ask for
> __isset_bit_vector.get(XXX))
> Now if you serialize the previous object and unserialize it (without doing
> any changes on it) the following occured : all fields that corresponds to
> native data are returning true when isSetXXX() is invoked.
> Consequently, the operation unserialise(serialize(object)) is not an identity
> function.
> This is mainly due that the __isset_bit_vector is not serialize and rebuild
> during the unserialize operation.
> Any idea how to fix this ?
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira