avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Cutting (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AVRO-1166) IDL return type of map<record> fails in schema processing
Date Fri, 14 Sep 2012 21:56:07 GMT

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

Doug Cutting updated AVRO-1166:
-------------------------------

    Attachment: AVRO-1166.patch

Here's a patch to fix this that includes a test case.

Unless there are objections I'll commit this soon.
                
> IDL return type of map<record> fails in schema processing
> ---------------------------------------------------------
>
>                 Key: AVRO-1166
>                 URL: https://issues.apache.org/jira/browse/AVRO-1166
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.1
>            Reporter: George Fletcher
>         Attachments: AVRO-1166.patch
>
>
> An IDL construct such as ...
> {code:title=Foo.idl}
> protocol MyService {
>     record Bar {
>         int     count;
>         string  message;
>     }
>     map<Bar> getBars();
> }
> {code}
> generates run-time errors because of this code in SpecificData.java
> {code:title=SpecificData.java lines 189-196}
>       } else if (Map.class.isAssignableFrom(raw)) {   // map
>         java.lang.reflect.Type key = params[0];
>         java.lang.reflect.Type value = params[1];
>         if (!(type instanceof Class
>               && CharSequence.class.isAssignableFrom((Class)type)))
>           throw new AvroTypeException("Map key class not CharSequence: "+key);
>         return Schema.createMap(createSchema(value, names));
>       } else {
> {code}
> the issue is that CharSequence.class.isAssignableFrom((Class)type)) should really be
CharSequence.class.isAssignableFrom((Class)*key*))

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message