[ 
https://issues.apache.org/jira/browse/AVRO-1754?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John McClean updated AVRO-1754:
-------------------------------
    Description: 
When decoding null, the ValidatingDecoder does not call the underlying 
'decodeNull' method. The result is that the next field decoded causes an 
exception.

For example, if this json

{quote}
        /{"a":null,"b":"bar"}
{quote}

is decoded with this schema

{quote}
        {
                "name": "foo",
                "type": "record",
                "fields": [
                        { "name": "a", "type": ["null", "string"] },
                        { "name": "b", "type": "string" }
                ]
        }
{quote}

it throws an exception with the message "Invalid operation. Expected: String 
got Null". This happens when 'b' is being decoded. I'll attach a patch.

  was:
When decoding null, the ValidatingDecoder does not call the underlying 
'decodeNull' method. The result is that the next field decoded causes an 
exception.

For example, if this json

{quote}
        {"a":null,"b":"bar"}
{quote}

is decoded with this schema

{quote}
        {
                "name": "foo",
                "type": "record",
                "fields": [
                        { "name": "a", "type": ["null", "string"] },
                        { "name": "b", "type": "string" }
                ]
        }
{quote}

it throws an exception with the message "Invalid operation. Expected: String 
got Null". This happens when 'b' is being decoded. I'll attach a patch.


> C++ ValiditingDecoder handles null incorrectly
> ----------------------------------------------
>
>                 Key: AVRO-1754
>                 URL: https://issues.apache.org/jira/browse/AVRO-1754
>             Project: Avro
>          Issue Type: Bug
>          Components: c++
>            Reporter: John McClean
>
> When decoding null, the ValidatingDecoder does not call the underlying 
> 'decodeNull' method. The result is that the next field decoded causes an 
> exception.
> For example, if this json
> {quote}
>       /{"a":null,"b":"bar"}
> {quote}
> is decoded with this schema
> {quote}
>       {
>               "name": "foo",
>               "type": "record",
>               "fields": [
>                       { "name": "a", "type": ["null", "string"] },
>                       { "name": "b", "type": "string" }
>               ]
>       }
> {quote}
> it throws an exception with the message "Invalid operation. Expected: String 
> got Null". This happens when 'b' is being decoded. I'll attach a patch.



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

Reply via email to