Sébastien Foutrier created AVRO-2618:
----------------------------------------

             Summary: C# DataFileReader requires Stream to be Seekable for no 
reason
                 Key: AVRO-2618
                 URL: https://issues.apache.org/jira/browse/AVRO-2618
             Project: Apache Avro
          Issue Type: Bug
          Components: csharp
            Reporter: Sébastien Foutrier


When calling the method DataFileReader.OpenReader on a non-seekable stream, the 
method throws an AvroException.

The requirements for this Seek() call is:
 # To ensure the magic number to be there and rewind the Stream afterward.
 # To be able to call the methods Seek and Sync.

The 1. is not useful as the Ctor does ensure again that the magic number is 
there (this is the reason why the Stream has to be rewind). This code can just 
be removed with no side effect, as a Stream without this magic number will 
throw itself an AvroException. (the message being "Not a valid data file!" 
instead of "Not an Avro data file").

The 2. could be checked at the call time of the method: the user that sends a 
non-seekable Stream should not call Seek or Sync upon the reader. (and by the 
way the Stream should throws a UnsupportedException at this time)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to