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

Binary input stream truncated #159

Closed
m0mus opened this issue Nov 6, 2018 · 1 comment
Closed

Binary input stream truncated #159

m0mus opened this issue Nov 6, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@m0mus
Copy link
Contributor

m0mus commented Nov 6, 2018

I am trying to use binary input stream for my rest calls but the input stream get's truncated once first FF byte is encountered.

The reason is following part of PublisherInputStream class:

    public int read() throws IOException {
...
               ByteBuffer currentBuffer = chunk != null && !chunk.isReleased() ? chunk.data() : null;
...               
                if (currentBuffer != null && currentBuffer.remaining() > 0) {
                    return currentBuffer.get();
                }
...

Here the FF byte is returned directly as int (== -1) which for input stream is interpreted as the end of stream.
The return currentBuffer.get(); line should be changed to currentBuffer.get() & 0xFF to return correct values.

Reported by Eva Krejcirova

@romain-grecourt
Copy link
Contributor

Fixed by pr #161

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

2 participants