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

Sebastien Dubois updated AVRO-2121:
-----------------------------------
    Description: 
Currently, GenericDatumWriter#writeWithoutConversion throws an NPE if some 
field is not defined as it should according to the schema.

I guess this is a matter of test, but as API client I'd like to rather get back 
an Avro-specific (runtime) exception (e.g., AvroWriteException), even if it 
wraps around an NPE. This makes it much more natural for writing libraries 
around.

With the code as it stands, my only choice to handle this would be to 
try/catch(npe), which doesn't feel great.

Debugging experience would also be improved if additional checks were 
implemented directly in writeWithoutConversion instead of letting the encoder 
implementations fail miserably because of null values

  was:
Currently, GenericDatumWriter#writeWithoutConversion throws an NPE if some 
field is not defined as it should according to the schema.

I guess this is a matter of test, but as API client I'd like to rather get back 
an Avro-specific (runtime) exception (e.g., AvroWriteException), even if it 
wraps around an NPE. This makes it much more natural for writing libraries 
around.

With the code as it stands, my only choice to handle this would be to 
try/catch(npe), which doesn't feel great.


> GenericDatumWriter#writeWithoutConversion throws NullPointerException
> ---------------------------------------------------------------------
>
>                 Key: AVRO-2121
>                 URL: https://issues.apache.org/jira/browse/AVRO-2121
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.8.2
>            Reporter: Sebastien Dubois
>            Priority: Minor
>
> Currently, GenericDatumWriter#writeWithoutConversion throws an NPE if some 
> field is not defined as it should according to the schema.
> I guess this is a matter of test, but as API client I'd like to rather get 
> back an Avro-specific (runtime) exception (e.g., AvroWriteException), even if 
> it wraps around an NPE. This makes it much more natural for writing libraries 
> around.
> With the code as it stands, my only choice to handle this would be to 
> try/catch(npe), which doesn't feel great.
> Debugging experience would also be improved if additional checks were 
> implemented directly in writeWithoutConversion instead of letting the encoder 
> implementations fail miserably because of null values



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to