Return-Path: X-Original-To: apmail-avro-dev-archive@www.apache.org Delivered-To: apmail-avro-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4C66418881 for ; Tue, 15 Dec 2015 04:11:47 +0000 (UTC) Received: (qmail 65593 invoked by uid 500); 15 Dec 2015 04:11:47 -0000 Delivered-To: apmail-avro-dev-archive@avro.apache.org Received: (qmail 65524 invoked by uid 500); 15 Dec 2015 04:11:46 -0000 Mailing-List: contact dev-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@avro.apache.org Delivered-To: mailing list dev@avro.apache.org Received: (qmail 65513 invoked by uid 99); 15 Dec 2015 04:11:46 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Dec 2015 04:11:46 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 9ED212C1F6F for ; Tue, 15 Dec 2015 04:11:46 +0000 (UTC) Date: Tue, 15 Dec 2015 04:11:46 +0000 (UTC) From: "David Lemieux (JIRA)" To: dev@avro.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AVRO-1584) Json output doesn't generate base64 for byte arrays MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AVRO-1584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15057312#comment-15057312 ] David Lemieux commented on AVRO-1584: ------------------------------------- [~rdblue] My pleasure. I agree that is should fix my problem. Thanks > 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, AVRO-1584.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 (v6.3.4#6332)