Alex Baumgarten created AVRO-1798:
-------------------------------------

             Summary: WriteFixed throws an exception for a null Fixed value 
instance.
                 Key: AVRO-1798
                 URL: https://issues.apache.org/jira/browse/AVRO-1798
             Project: Avro
          Issue Type: Bug
          Components: csharp
    Affects Versions: 1.8.0
         Environment: Windows 8.1
            Reporter: Alex Baumgarten


Code generated with:
{"name": "MyShort", "type": ["null", {"type": "fixed", "name": "short", "size": 
2}]},

When writing a record that has a null value for MyShort it throws the 
exception: "Fixed object is not derived from SpecificFixed"

At:
Avro.Specific.SpecificDatumWriter.WriteFixed()

when it tries to interpret the "value as SpecificFixed"

protected override void WriteFixed(FixedSchema schema, object value, Encoder 
encoder)
        {
            var fixedrec = value as SpecificFixed;
            if (fixedrec == null)
                throw new AvroTypeException("Fixed object is not derived from 
SpecificFixed");

            encoder.WriteFixed(fixedrec.Value);
        }



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

Reply via email to