[
https://issues.apache.org/jira/browse/AVRO-820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13035238#comment-13035238
]
Doug Cutting commented on AVRO-820:
-----------------------------------
Thanks for the use case.
A NullPointerException could come from lots of places besides the DatumWriter,
no? I'd prefer we add a new exception for this particular case to avoid such
potential confusion. EncoderException is perhaps not a good name. Maybe
something like ExceptionWhileEncodingForFile would be better? The semantics
would be that, when this is thrown, the datum was not written due to an
exception while serializing it to the buffer but the file remains in a
consistent state.
> Java: Exceptions thrown while encoding a record while writing an Avro Data
> file will produce a corrupt file.
> -------------------------------------------------------------------------------------------------------------
>
> Key: AVRO-820
> URL: https://issues.apache.org/jira/browse/AVRO-820
> Project: Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.4.1, 1.5.0, 1.5.1
> Reporter: Scott Carey
> Assignee: Scott Carey
> Priority: Critical
> Attachments: AVRO-820.patch
>
>
> If an exception is thrown while serializing a record in
> DataFileWriter<D>.append(D) partial contents of that serialization will end
> up in the file. This corrupts the block.
> DataFileWriter should ensure that the buffer is rewound to the state prior to
> the record write in the case of an exception thrown during serialization to
> prevent creating a corrupt file.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira