You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Tycho Lamerigts (JIRA)" <ji...@apache.org> on 2015/02/10 20:03:11 UTC

[jira] [Commented] (AVRO-1638) SpecificDatumReader cannot read inner classes

    [ https://issues.apache.org/jira/browse/AVRO-1638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14314671#comment-14314671 ] 

Tycho Lamerigts commented on AVRO-1638:
---------------------------------------

Although not needed to reproduce the bug, for completeness sake I will mention that I generated the attached avro file with ReflectDatumWriter<Foo>, where Foo is defined as

{code}
package test;

public class Foo {

    private final Bar bar;

    public Foo(Bar bar) {
        this.bar = bar;
    }

    public Bar getBar() {
        return bar;
    }

    public static class Bar {

        private final String str;

        public Bar(String str) {
            this.str = str;
        }

        public String getStr() {
            return str;
        }
    }
}
{code}

> SpecificDatumReader cannot read inner classes
> ---------------------------------------------
>
>                 Key: AVRO-1638
>                 URL: https://issues.apache.org/jira/browse/AVRO-1638
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.7
>            Reporter: Tycho Lamerigts
>         Attachments: foo.avro
>
>
> After generating Specific classes from the attached avro file's schema, the file's content cannot be read by the following code.
> {code}
> DatumReader<Foo> r = new SpecificDatumReader<>(Foo.class);
> DataFileReader<Foo> fr = new DataFileReader<>(new File("foo.avro"), r);
> fr.next(); // this will throw
> {code}
> It appears to me that the logic in SpecificData#getClassName for dealing with names ending with '$' is incorrect, which causes avro to fall back to GenericDatumReader and ultimately fail.



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