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

ASF GitHub Bot commented on THRIFT-3098:
----------------------------------------

GitHub user roshan opened a pull request:

    https://github.com/apache/thrift/pull/445

    THRIFT-3098 Print binary typedefs the same way we do binary fields

    Now
    
    ```
    typedef BinType binary
    struct BinHolder {
     1: binary bin_field
     2: BinType typedef_field
    }
    ```
    
    generates
    
    ```
     sb.append("bin_field:");
        if (this.bin_field == null) {
          sb.append("null");
        } else {
          org.apache.thrift.TBaseHelper.toString(this.bin_field, sb);
        }
        first = false;
        if (!first) sb.append(", ");
        sb.append("typedef_field:");
        if (this.typedef_field == null) {
          sb.append("null");
        } else {
          org.apache.thrift.TBaseHelper.toString(this.typedef_field, sb);
        }
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/roshan/thrift THRIFT-3098_pretty_print_typedef

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/445.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #445
    
----
commit d15303be96ec2ef1da3410f70fe396f1f61fb22e
Author: Roshan George <ros...@arjie.com>
Date:   2015-04-16T04:39:39Z

    THRIFT-3098 Print binary typedefs the same way we do binary fields

----


> Thrift does not pretty print binary typedefs the way it does binary fields
> --------------------------------------------------------------------------
>
>                 Key: THRIFT-3098
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3098
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler
>    Affects Versions: 0.9.3
>            Reporter: Roshan George
>            Priority: Trivial
>
> The generated Java struct toString uses TBaseHelper.toString to print binary 
> fields but not fields which are typedef binary.
> e.g.
> {code}
> typedef BinType binary
> struct BinHolder {
>  1: binary bin_field
>  2: BinType typedef_field
> }
> {code}
> results in
> {code}
>  sb.append("bin_field:");
>     if (this.bin_field == null) {
>       sb.append("null");
>     } else {
>       org.apache.thrift.TBaseHelper.toString(this.bin_field, sb);
>     }
>     first = false;
>     if (!first) sb.append(", ");
>     sb.append("typedef_field:");
>     if (this.typedef_field == null) {
>       sb.append("null");
>     } else {
>       sb.append(this.typedef_field);
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to