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 returns incorrect result [SPR-14209] #18783

spring-issuemaster opened this issue Apr 22, 2016 · 1 comment


Copy link

@spring-issuemaster spring-issuemaster commented Apr 22, 2016

Javier Godoy opened SPR-14209 and commented[]) returns incorrect result when the read buffer is bigger than the InputStream contents.

FastByteArrayOutputStream out = new FastByteArrayOutputStream();
out.write(new byte[42]);
System.out.println(out.getInputStream().read(new byte[43]));

Actual output: 41
Expected output: 42

The FBAIN implementation first reads all the available input, and a temporary read count of n is computed. Then it calls read again, which returns -1 (end of stream). That -1 is added to the read count, returning n-1 instead of n.

Affects: 4.2.5

Issue Links:

  • #18809 FastByteArrayInputStream read( byte[] ) wrong return value ("is duplicated by")

Referenced from: commits 9bf5a5c, b9fa67e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.