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 969E59814 for ; Tue, 7 Feb 2012 19:03:25 +0000 (UTC) Received: (qmail 79812 invoked by uid 500); 7 Feb 2012 19:03:25 -0000 Delivered-To: apmail-avro-dev-archive@avro.apache.org Received: (qmail 79743 invoked by uid 500); 7 Feb 2012 19:03:24 -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 79735 invoked by uid 99); 7 Feb 2012 19:03:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Feb 2012 19:03:24 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Feb 2012 19:03:21 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 736A61A7379 for ; Tue, 7 Feb 2012 19:03:00 +0000 (UTC) Date: Tue, 7 Feb 2012 19:03:00 +0000 (UTC) From: "Doug Cutting (Updated) (JIRA)" To: dev@avro.apache.org Message-ID: <1274066678.9565.1328641380474.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <250189271.7002.1328597459307.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (AVRO-1020) Builder API fails to substitute default values for enum types MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/AVRO-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Doug Cutting updated AVRO-1020: ------------------------------- Fix Version/s: 1.6.2 Assignee: Doug Cutting Status: Patch Available (was: Open) > Builder API fails to substitute default values for enum types > ------------------------------------------------------------- > > Key: AVRO-1020 > URL: https://issues.apache.org/jira/browse/AVRO-1020 > Project: Avro > Issue Type: Bug > Components: java > Affects Versions: 1.6.1 > Reporter: James Baldassari > Assignee: Doug Cutting > Fix For: 1.6.2 > > Attachments: AVRO-1020.bug.patch, AVRO-1020.patch > > > If a schema has an enum type with a default value, and the Builder API is used to automatically substitute the default value on build(), a ClassCastException is thrown. The reason is that the default value resolves to a GenericData.EnumSymbol. The specific builder then attempts to cast this value to the corresponding Java enum type, which fails. Here is an example stack trace: > {noformat} > org.apache.avro.AvroRuntimeException: java.lang.ClassCastException: org.apache.avro.generic.GenericData$EnumSymbol cannot be cast to org.apache.avro.ipc.specific.PrivacyType > at org.apache.avro.ipc.specific.Person$Builder.build(Person.java:410) > at org.apache.avro.specific.TestSpecificRecordBuilder.testSpecificBuilder(TestSpecificRecordBuilder.java:51) > Caused by: java.lang.ClassCastException: org.apache.avro.generic.GenericData$EnumSymbol cannot be cast to org.apache.avro.ipc.specific.PrivacyType > at org.apache.avro.ipc.specific.Person$Builder.build(Person.java:407) > ... 24 more > {noformat} -- 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