Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read with len = 0 should return 0 bytes read. #201

Open
1 task done
fuatbasik opened this issue Dec 18, 2024 · 0 comments
Open
1 task done

Read with len = 0 should return 0 bytes read. #201

fuatbasik opened this issue Dec 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@fuatbasik
Copy link
Contributor

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.

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

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant