avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan Blue (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1584) Json output doesn't generate base64 for byte arrays
Date Tue, 15 Dec 2015 00:59:46 GMT

    [ https://issues.apache.org/jira/browse/AVRO-1584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15057097#comment-15057097

Ryan Blue commented on AVRO-1584:

[~lemieud], thank you for your work to get this addressed! I think that the fix we ended up
with should fix the problem you were seeing since the control characters will be properly
escaped. If moving to base64 is important to you as well, then I think the right way forward
is to help standardize a different JSON encoding, like Doug suggested for the long term. For
now, I'm going to mark this issue resolved since we've decided the way forward in the short

> Json output doesn't generate base64 for byte arrays
> ---------------------------------------------------
>                 Key: AVRO-1584
>                 URL: https://issues.apache.org/jira/browse/AVRO-1584
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.7
>         Environment: Pure java.
>            Reporter: Christophe Lorenz
>         Attachments: AVRO-1584-Jackson-Base64-Default-Variant.patch, AVRO-1584.1.patch,
> The Json output of java generated code doesn't correctly encode byte arrays.
> Using this simple schema : 
> {"namespace": "example.avro",
>  "type": "record",
>  "name": "ByteArrayEncoding",
>  "fields": [     {"name": "data", "type": "bytes"} ]
> }
> The toString()  
> 	System.out.println(new ByteArrayEncoding(ByteBuffer.wrap(new byte[]{0,31,65,66,67,(byte)255,(byte)182})));
> Returns raw bytes to string in the json :
> {"data": {"bytes": "  ABC??"}}
> As a byte array is not tied to be a valid string, it should be converted back and forth
to Base64 like other Json implementations : 
> {"data": {"bytes": "AB9BQkP/tg=="}}

This message was sent by Atlassian JIRA

View raw message