Skip to content

Conversation

okumin
Copy link
Contributor

@okumin okumin commented Jan 18, 2022

I found MessageUnpacker#getTotalReadBytes doesn't return correct size once I invoke MessageUnpacker#close.

That's because MessageUnpacker#close drops the current buffer without updating the read size
https://github.com/msgpack/msgpack-java/blob/v0.9.0/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L1738-L1740

even though MessageUnpacker#getTotalReadBytes requires the size of the latest buffer.
https://github.com/msgpack/msgpack-java/blob/v0.9.0/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L261

@okumin okumin force-pushed the read-size-after-close branch from c65c2a4 to 99c2735 Compare January 18, 2022 09:00
@komamitsu
Copy link
Member

@xerial ^ What do you think?

@yuokada
Copy link

yuokada commented Feb 4, 2022

@komamitsu It's good to ping him via slack or twitter. IIRC, he doesn't watch notifications from github.

@xerial
Copy link
Member

xerial commented Mar 7, 2022

Thanks for the fix. Yeah. position value needs to be reflected to the total read size before resetting to 0

@xerial xerial merged commit ceffe07 into msgpack:develop Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants