Skip to content

Commit 86f443c

Browse files
committed
Ensure flushing CharsetEncoder
1 parent 9cc49c0 commit 86f443c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

msgpack-core/src/main/java/org/msgpack/core/MessagePacker.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,11 @@ private int encodeStringToBufferAt(int pos, String s)
471471
// Underflow should be on to ensure all of the input string is encoded
472472
return -1;
473473
}
474+
// NOTE: This flush method does nothing if we use UTR8 encoder, but other general encoders require this
475+
cr = encoder.flush(bb);
476+
if (!cr.isUnderflow()) {
477+
return -1;
478+
}
474479
return bb.position() - startPosition;
475480
}
476481

0 commit comments

Comments
 (0)