You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Brian Bloniarz (JIRA)" <ji...@apache.org> on 2012/06/07 23:42:23 UTC

[jira] [Comment Edited] (THRIFT-1624) Isset Generated differently on different platforms

    [ https://issues.apache.org/jira/browse/THRIFT-1624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13291333#comment-13291333 ] 

Brian Bloniarz edited comment on THRIFT-1624 at 6/7/12 9:41 PM:
----------------------------------------------------------------

Here's a theory: maybe t_struct::is_union_ is just an uninitialized variable?

The t_struct constructor doesn't initialize it. thrifty.yy line 724 will initialize it for struct/union declarations, but I'm guessing that codepath is skipped for service declarations.

                
      was (Author: brianbloniarz):
    Here's a theory: maybe t_struct::is_union_ is just an uninitialized variable?

The t_struct constructor doesn't initialize it. thrift.yy line 724 will initialize it for struct/union declarations, but I'm guessing that codepath is skipped for service declarations.

                  
> Isset Generated differently on different platforms
> --------------------------------------------------
>
>                 Key: THRIFT-1624
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1624
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (General), Java - Compiler
>    Affects Versions: 0.9
>         Environment: CentOS 5 Mac OS X
>            Reporter: Nathaniel Cook
>
> Genereated java code is different depending on the environment. 
> Example Service:
> {code}
> service IssetService
> {
>    bool test()
> }
> {code}
> CentOS 5 result:
> {code:java}
>     private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
>       try {
>         read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
>       } catch (org.apache.thrift.TException te) {
>         throw new java.io.IOException(te);
>       }
>     }
> {code}
> Mac OS X result:
> {code:java}
>     private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
>       try {
>         // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
>         __isset_bitfield = 0;
>         read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
>       } catch (org.apache.thrift.TException te) {
>         throw new java.io.IOException(te);
>       }
>     }
> {code}
> The inconsistency is a problem as we have a hybrid env. Also we are unsure which is correct.
> I have dug around in the code and is seems to come down to this method "tstruct->is_union()". On CentOS the struct is a union so the 'isset' code is omitted. While the opposite is true for Mac OS X. I am still unsure as to the cause but before I submit a patch I need to know which is correct.

--
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