You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Andy Le (Jira)" <ji...@apache.org> on 2020/03/23 01:21:00 UTC
[jira] [Created] (AVRO-2778) Java: Reflect raises exceptions while
dealing with non-static classes
Andy Le created AVRO-2778:
-----------------------------
Summary: Java: Reflect raises exceptions while dealing with non-static classes
Key: AVRO-2778
URL: https://issues.apache.org/jira/browse/AVRO-2778
Project: Apache Avro
Issue Type: Bug
Components: java
Affects Versions: 1.9.2
Reporter: Andy Le
Hi guys,
I've got the following simple code:
{code:java}
public class TestReflect {
public class Human{
String name = "Andy";
}
@Test
public void testNonStaticClasses(){
ReflectData.get().getSchema(Human.class) ;
}
}
{code}
When I run the test, an exception is spawn:
{noformat}
org.apache.avro.SchemaParseException: Illegal character in: this$0
at org.apache.avro.Schema.validateName(Schema.java:1530)
at org.apache.avro.Schema.access$400(Schema.java:87)
at org.apache.avro.Schema$Field.<init>(Schema.java:518)
at org.apache.avro.Schema$Field.<init>(Schema.java:557)
at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:645)
at org.apache.avro.specific.SpecificData$3.computeValue(SpecificData.java:335)
at org.apache.avro.specific.SpecificData$3.computeValue(SpecificData.java:1)
at java.lang.ClassValue.getFromHashMap(ClassValue.java:227)
at java.lang.ClassValue.getFromBackup(ClassValue.java:209)
at java.lang.ClassValue.get(ClassValue.java:115)
at org.apache.avro.specific.SpecificData.getSchema(SpecificData.java:346)
...
{noformat}
It seems to me that: Avro Reflect does NOT effectively handle non-static classes.
Should I make a PR against this issue?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)