[
https://issues.apache.org/jira/browse/AVRO-4048?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated AVRO-4048:
---------------------------------
Labels: pull-request-available (was: )
> 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
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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}end up skipping over some smaller number of bytes, possibly {{{}0{}}}.
> This may result from any of a number of conditions; reaching end of file
> before {{n}} bytes have been skipped is only one possibility.
> {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 return values (EOF returns zero) and
> therefore should not be supported. There exist no unit tests today the
> suggest that this is supported. Just remove the superfluous branching logic.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)