avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Cutting (Updated) (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AVRO-1020) Builder API fails to substitute default values for enum types
Date Tue, 07 Feb 2012 19:03:00 GMT

     [ 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

        

Mime
View raw message