You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Analytics Accelerator Library for Amazon S3 Version
0.0.1, 0.0.2
AWS Region
us-east-1
Describe the running environment
Running in EC2 instance and mac.
What happened?
According to InputStream specification, when reader tries to read 0 bytes, read method should return 0 bytes read, independent of the object size.
See:
If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte. If no byte is available because the stream is at end of file, the value -1 is returned; otherwise, at least one byte is read and stored into b.
In S3SeekableInputStream for an 0-sized object implementation of the read method will return -1.
…203)
## Description of change
According to InputStream documentation Len = 0 should return 0
`If len is zero, then no bytes are read and 0 is returned;`
Following the InputStream implementation, this commit is adding argument
checks to Positioned Reads. This validation is implemented in the
SeekableInputStream to ensure all subclasses behave the same way in the
unhappy path.
Checks are done in the same order with InputStream implementation.
#### Relevant issues
#201
#### Does this contribution introduce any breaking changes to the
existing APIs or behaviors?
Yes. For a 0-length read to a 0-sized object read will now return 0
instead of -1.
Insufficient Buffer Capacity will now throw IndexOutOfBoundsException
instead of IllegalArgumentException.
#### Does this contribution introduce any new public APIs or behaviors?
No, it changes existing public API behaviour.
#### How was the contribution tested?
Added new unit tests.
#### Does this contribution need a changelog entry?
- [N/A] I have updated the CHANGELOG or README if appropriate
---
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and I agree to the terms of
the [Developer Certificate of Origin
(DCO)](https://developercertificate.org/).
Analytics Accelerator Library for Amazon S3 Version
0.0.1, 0.0.2
AWS Region
us-east-1
Describe the running environment
Running in EC2 instance and mac.
What happened?
According to InputStream specification, when reader tries to read 0 bytes, read method should return 0 bytes read, independent of the object size.
See:
In S3SeekableInputStream for an 0-sized object implementation of the read method will return -1.
https://github.com/awslabs/analytics-accelerator-s3/blob/main/input-stream/src/main/java/software/amazon/s3/analyticsaccelerator/S3SeekableInputStream.java#L135-L153
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: