David Mollitor created AVRO-4048:
------------------------------------
Summary: Ignore Negative Return Values for InputStream Skip
Key: AVRO-4048
URL: https://issues.apache.org/jira/browse/AVRO-4048
Project: Apache Avro
Issue Type: Improvement
Components: java
Affects Versions: 1.13.0
Reporter: David Mollitor
Assignee: David Mollitor
There are a couple of places in the code with the following:
{code:java}
// The inputStream contract is evil.
// zero "might" mean EOF. So check for 2 in a row, we will
// infinite loop waiting for -1 with some classes others
// spuriously will return 0 on occasion without EOF {code}
Which, is understandable that this is in place for a 'read' method. However,
'skip' has the following contract:
{quote}the actual number of bytes skipped which might be zero.
{quote}
[https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/InputStream.html#skip(long)]
There is no mention of a negative value and therefore should not be supported.
There exist no unit tests today the suggest that this is supported. Just remove
the extra superfluous branching logic.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)