You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Lukas Steiblys (JIRA)" <ji...@apache.org> on 2014/10/09 01:23:33 UTC

[jira] [Updated] (AVRO-1592) Appended dollar sign at the end of an enum constant causes deserialization to fail.

     [ https://issues.apache.org/jira/browse/AVRO-1592?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukas Steiblys updated AVRO-1592:
---------------------------------
    Attachment: avrobug.tar.gz

Minimal maven project to reproduce the bug. Run:
mvn package exec:java


> Appended dollar sign at the end of an enum constant causes deserialization to fail.
> -----------------------------------------------------------------------------------
>
>                 Key: AVRO-1592
>                 URL: https://issues.apache.org/jira/browse/AVRO-1592
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.7
>         Environment: CentOS, Java 1.7
>            Reporter: Lukas Steiblys
>         Attachments: avrobug.tar.gz
>
>
> The schema {"type": "enum", "name": "ButtonTypeID", "symbols": ["default", "keyboard"]} generates the following class:
>  
> public final class ButtonTypeID extends java.lang.Enum<ButtonTypeID> {
>   public static final ButtonTypeID default$;
>   public static final ButtonTypeID keyboard;
>   public static final org.apache.avro.Schema SCHEMA$;
>   public static ButtonTypeID[] values();
>   public static ButtonTypeID valueOf(java.lang.String);
>   public static org.apache.avro.Schema getClassSchema();
>   static {};
> }
>  
> (this is what “javap ButtonTypeID.class” produces)
>  
> When I try to read my data that has the “default” value for ButtonTypeID, I get the exception:
> java.lang.IllegalArgumentException: No enum constant ButtonTypeID.default
> 	at java.lang.Enum.valueOf(Enum.java:236)
> 	at org.apache.avro.specific.SpecificData.createEnum(SpecificData.java:106)
> 	at org.apache.avro.generic.GenericDatumReader.createEnum(GenericDatumReader.java:205)...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)