avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amine R. (JIRA)" <j...@apache.org>
Subject [jira] [Created] (AVRO-1148) SpecificData.java has a bug creating a schema for a map
Date Fri, 07 Sep 2012 20:14:07 GMT
Amine R. created AVRO-1148:
------------------------------

             Summary: SpecificData.java has a bug creating a schema for a map
                 Key: AVRO-1148
                 URL: https://issues.apache.org/jira/browse/AVRO-1148
             Project: Avro
          Issue Type: Bug
          Components: java
    Affects Versions: 1.6.3
         Environment: Mac
            Reporter: Amine R.


in the SepcificData class, the protected Schema createSchema(java.lang.reflect.Type type,
Map<String,Schema> names) fails in creating a schema for the Map type.

Looking at this excerpt, 

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));
      }

The type is a map, the key is a string. therefore instead of  "if (!(type instanceof Class"
it should be "if (!(key instanceof Class".


--
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