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

Alexandre Normand commented on AVRO-1368:
-----------------------------------------

It looks like we want {{SpecificDatumWriter#writeString()}} to check is the 
object is stringable before calling {{toString()}} on it.

This assumes this is Stringable but your example shows that it's a bad 
assumption:
{code}
@Override
  protected void writeString(Schema schema, Object datum, Encoder out)
    throws IOException {
    if (!(datum instanceof CharSequence))         // Stringable
      datum = datum.toString();                   // call toString()
    writeString(datum, out);
  }
{code}

                
> 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

Reply via email to