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 CA02211531 for ; Mon, 22 Sep 2014 22:30:34 +0000 (UTC) Received: (qmail 7622 invoked by uid 500); 22 Sep 2014 22:30:34 -0000 Delivered-To: apmail-avro-dev-archive@avro.apache.org Received: (qmail 7545 invoked by uid 500); 22 Sep 2014 22:30:34 -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 7533 invoked by uid 99); 22 Sep 2014 22:30:34 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Sep 2014 22:30:34 +0000 Date: Mon, 22 Sep 2014 22:30:34 +0000 (UTC) From: "Joey Echeverria (JIRA)" To: dev@avro.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (AVRO-1588) ReflectData.AllowNull incorrectly handles primitive types. 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-1588?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Joey Echeverria resolved AVRO-1588. ----------------------------------- Resolution: Duplicate > ReflectData.AllowNull incorrectly handles primitive types. > ---------------------------------------------------------- > > Key: AVRO-1588 > URL: https://issues.apache.org/jira/browse/AVRO-1588 > Project: Avro > Issue Type: Bug > Components: java > Affects Versions: 1.7.7 > Reporter: Joey Echeverria > > When doing the following: > {code:java} > private static class PoJo { > private long id; > private String name; > } > ReflectData.AllowNull.get().getSchema(PoJo.class); > {code} > I'd expect a schema like this: > {code:javascript} > { > "type" : "record", > "name" : "PoJo", > "namespace" : "MyObject$", > "fields" : [ { > "name" : "id", > "type" : "long", > }, { > "name" : "name", > "type" : [ "null", "string" ], > "default" : null > } ] > } > {code} > But instead I get: > {code:javascript} > { > "type" : "record", > "name" : "PoJo", > "namespace" : "MyObject$", > "fields" : [ { > "name" : "id", > "type" : [ "null", "long" ], > "default" : null > }, { > "name" : "name", > "type" : [ "null", "string" ], > "default" : null > } ] > } > {code} > This will later result in an NullPointerException when you try to deserialize bytes where id was null when it tries to convert the Long to a long. -- This message was sent by Atlassian JIRA (v6.3.4#6332)