You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Kevin Zhao (Created) (JIRA)" <ji...@apache.org> on 2012/04/18 06:09:14 UTC

[jira] [Created] (AVRO-1064) Encoder.writeString throws NullPointerException when the charSequence is null

Encoder.writeString throws NullPointerException when the charSequence is null
-----------------------------------------------------------------------------

                 Key: AVRO-1064
                 URL: https://issues.apache.org/jira/browse/AVRO-1064
             Project: Avro
          Issue Type: Bug
          Components: java
    Affects Versions: 1.6.3
            Reporter: Kevin Zhao
             Fix For: 1.7.0



org.apache.avro.io.Encoder.writeString(CharSequence charSequence) throws NullPointerException when dealing with a javabean which has a null value in one of its fields, like the following one:

Person person = new Person();
person.setName("Kevin");
person.setId(null);





--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AVRO-1064) Encoder.writeString throws NullPointerException when the charSequence is null

Posted by "Kevin Zhao (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-1064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Zhao updated AVRO-1064:
-----------------------------

    Attachment: Encoder.java.patch
    
> Encoder.writeString throws NullPointerException when the charSequence is null
> -----------------------------------------------------------------------------
>
>                 Key: AVRO-1064
>                 URL: https://issues.apache.org/jira/browse/AVRO-1064
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.6.3
>            Reporter: Kevin Zhao
>             Fix For: 1.7.0
>
>         Attachments: Encoder.java.patch
>
>
> org.apache.avro.io.Encoder.writeString(CharSequence charSequence) throws NullPointerException when dealing with a javabean which has a null value in one of its fields, like the following one:
> Person person = new Person();
> person.setName("Kevin");
> person.setId(null);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AVRO-1064) Encoder.writeString throws NullPointerException when the charSequence is null

Posted by "Kevin Zhao (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-1064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Zhao updated AVRO-1064:
-----------------------------

    Status: Patch Available  (was: Open)
    
> Encoder.writeString throws NullPointerException when the charSequence is null
> -----------------------------------------------------------------------------
>
>                 Key: AVRO-1064
>                 URL: https://issues.apache.org/jira/browse/AVRO-1064
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.6.3
>            Reporter: Kevin Zhao
>             Fix For: 1.7.0
>
>         Attachments: Encoder.java.patch
>
>
> org.apache.avro.io.Encoder.writeString(CharSequence charSequence) throws NullPointerException when dealing with a javabean which has a null value in one of its fields, like the following one:
> Person person = new Person();
> person.setName("Kevin");
> person.setId(null);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (AVRO-1064) Encoder.writeString throws NullPointerException when the charSequence is null

Posted by "Thiruvalluvan M. G. (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-1064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13257609#comment-13257609 ] 

Thiruvalluvan M. G. commented on AVRO-1064:
-------------------------------------------

The patch makes Encoder treat {{null}} for Avro {{String}} as empty. There is no such requirement in Encoder's specification. This would make the the spec somewhat non-uniform. For example, if we assign the interpretation for {{null}} for Avro {{String}}, we should also add interpretation for {{null}} for Avro {{bytes}}, {{fixed}} and so on.

I think ensuring the the bean doesn't have {{null}} member or annotating the property {{@Nullable}} is a better way to handle this.
                
> Encoder.writeString throws NullPointerException when the charSequence is null
> -----------------------------------------------------------------------------
>
>                 Key: AVRO-1064
>                 URL: https://issues.apache.org/jira/browse/AVRO-1064
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.6.3
>            Reporter: Kevin Zhao
>             Fix For: 1.7.0
>
>         Attachments: Encoder.java.patch
>
>
> org.apache.avro.io.Encoder.writeString(CharSequence charSequence) throws NullPointerException when dealing with a javabean which has a null value in one of its fields, like the following one:
> Person person = new Person();
> person.setName("Kevin");
> person.setId(null);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (AVRO-1064) Encoder.writeString throws NullPointerException when the charSequence is null

Posted by "Kevin Zhao (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-1064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13256188#comment-13256188 ] 

Kevin Zhao commented on AVRO-1064:
----------------------------------

request for code reviewing~
                
> Encoder.writeString throws NullPointerException when the charSequence is null
> -----------------------------------------------------------------------------
>
>                 Key: AVRO-1064
>                 URL: https://issues.apache.org/jira/browse/AVRO-1064
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.6.3
>            Reporter: Kevin Zhao
>             Fix For: 1.7.0
>
>         Attachments: Encoder.java.patch
>
>
> org.apache.avro.io.Encoder.writeString(CharSequence charSequence) throws NullPointerException when dealing with a javabean which has a null value in one of its fields, like the following one:
> Person person = new Person();
> person.setName("Kevin");
> person.setId(null);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira