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
{{ message }}
Repository navigation
MessageBuffer.sliceAsByteBuffer() method has old values after MessageBufferPacker.clear() #458
I expected it to print the same value 3 times, but its output is:
[2]
[2]
[1]
AFAIU there is a bug somewhere - in clear() implementation or somewhere else. I think it is in clear() because removing flush() produces the following output:
[1, 2]
[1, 2]
[1, 2]
It seems that clear() has no effect at all in this case.
@isopov Current MessagePacker interface is not designed for allow rewriting, because the buffer)(internally multiple buffers are used) might be already flushed out to the output target.
Activity
xerial commentedon Feb 12, 2018
@isopov Current MessagePacker interface is not designed for allow rewriting, because the buffer)(internally multiple buffers are used) might be already flushed out to the output target.
If you need to reuse buffer, MessagePacker.reset is the method for that:
https://static.javadoc.io/org.msgpack/msgpack-core/0.8.14/org/msgpack/core/MessagePacker.html#reset-org.msgpack.core.buffer.MessageBufferOutput-
For BufferPacker, fixes in #459 look OK to have. I'll merge it. Thanks