avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christophe Taton (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1368) String schema accepts any Java object, and converts it with toString()
Date Tue, 27 Aug 2013 17:51:53 GMT

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

Christophe Taton commented on AVRO-1368:
----------------------------------------

Here is a test that demonstrates the behavior:
{code}
    final Schema schema = Schema.create(Schema.Type.STRING);
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final Encoder encoder = EncoderFactory.get().directBinaryEncoder(baos, null);
    final DatumWriter<Object> writer = new SpecificDatumWriter<Object>(schema);
    writer.write(new Object(), encoder);
    final byte[] bytes = baos.toByteArray();
    System.out.println(new String(bytes));
{code}

The java Object is silently accepted and converted to a string like "java.lang.Object@ee51b2c".
                
> String schema accepts any Java object, and converts it with toString()
> ----------------------------------------------------------------------
>
>                 Key: AVRO-1368
>                 URL: https://issues.apache.org/jira/browse/AVRO-1368
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.5
>            Reporter: Christophe Taton
>


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