File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
msgpack-core/src/main/java/org/msgpack/core Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -449,6 +449,7 @@ private void prepareEncoder()
449449 if (encoder == null ) {
450450 this .encoder = MessagePack .UTF8 .newEncoder ();
451451 }
452+ encoder .reset ();
452453 }
453454
454455 private int encodeStringToBufferAt (int pos , String s )
@@ -457,7 +458,6 @@ private int encodeStringToBufferAt(int pos, String s)
457458 ByteBuffer bb = buffer .sliceAsByteBuffer (pos , buffer .size () - pos );
458459 int startPosition = bb .position ();
459460 CharBuffer in = CharBuffer .wrap (s );
460- encoder .reset ();
461461 CoderResult cr = encoder .encode (in , bb , true );
462462 if (cr .isError ()) {
463463 try {
@@ -471,7 +471,7 @@ 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
474+ // NOTE: This flush method does nothing if we use UTF8 encoder, but other general encoders require this
475475 cr = encoder .flush (bb );
476476 if (!cr .isUnderflow ()) {
477477 return -1 ;
You can’t perform that action at this time.
0 commit comments