Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.8.2
-
None
-
None
Description
In org.apache.avro.reflect.ReflectData::createFieldSchema the following code is processing Stringable after explicitly creating a schema
Schema schema = createSchema(field.getGenericType(), names); if (field.isAnnotationPresent(Stringable.class)) { // Stringable schema = Schema.create(Schema.Type.STRING); }
The above code has a side effect when @Stringable annotation is placed over a Generic Type like ID which results in Unknown Type ID since the schema is created first which causes the error.
Changing the code to following would fix this. Also it would also act as a micro optimization of the code as the generated schema is overwritten if stringable annotation is preset
Schema schema = null; if (field.isAnnotationPresent(Stringable.class)) { // Stringable schema = Schema.create(Schema.Type.STRING); } else { schema = createSchema(field.getGenericType(), names); }
Attachments
Issue Links
- relates to
-
AVRO-1341 Allow controlling avro via java annotations when using reflection.
- Closed