ASF GitHub Bot commented on AVRO-2127:

busbey commented on a change in pull request #273: AVRO-2127 Make 
InvalidAvroMagicException thrown if stream header is corrupted
URL: https://github.com/apache/avro/pull/273#discussion_r167560025

 File path: 
 @@ -47,7 +47,7 @@
                                              DatumReader<D> reader)
     throws IOException {
     if (in.length() < MAGIC.length)
-      throw new IOException("Not an Avro data file");
+      throw new EOFException("Not an Avro data file");
 Review comment:
   Will this be confusing? Say I want to take files and throw them at the wall 
to see what sticks. With this change as-is I'll need to see if the IOE is 
either EOF or IAM. Is that desirable? Do we gain enough by being able to 
distinguish the case where the magic header was invalid due to not enough bytes?

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> Throwing more specific exception if an avro file has currupted magic
> --------------------------------------------------------------------
>                 Key: AVRO-2127
>                 URL: https://issues.apache.org/jira/browse/AVRO-2127
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.8.2
>            Reporter: Dmitrii Bundin
>            Assignee: Dmitrii Bundin
>            Priority: Minor
> Curently we have IOException thrown if an avro file has incorrect magic. 
> It seems reasonable to throw a subclass of IOException to be able to handle 
> incorrect magic (in case length are match) in user code.

This message was sent by Atlassian JIRA

Reply via email to