Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit28e543c

Browse files
committed
Clear Utf8ByteBufCharsetDecoder#splitCharBuffer once char is complete,closeAsyncHttpClient#1357
Motivation:When multiple non US-ASCII chars are split over several chunks,Utf8ByteBufCharsetDecoder crashes with BufferOverflowException.This happens because we don't clear the splitCharBuffer in-between andonly do so once decoding is done.Modifications:Clear Utf8ByteBufCharsetDecoder#splitCharBuffer once char is completeResult:No more BufferOverflowException
1 parentb037426 commit28e543c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

‎netty-utils/src/main/java/org/asynchttpclient/netty/util/Utf8ByteBufCharsetDecoder.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,13 @@ private void handleSplitCharBuffer(ByteBuffer nioBuffer, boolean endOfInput) thr
116116
if (res.isError()) {
117117
res.throwException();
118118
}
119+
splitCharBuffer.clear();
119120
}
120121
}
121122

122123
protectedvoiddecodePartial(ByteBuffernioBuffer,booleanendOfInput)throwsCharacterCodingException {
123124
// deal with pending splitCharBuffer
124-
if (splitCharBuffer !=null &&splitCharBuffer.position() >0 &&nioBuffer.hasRemaining()) {
125+
if (splitCharBuffer.position() >0 &&nioBuffer.hasRemaining()) {
125126
handleSplitCharBuffer(nioBuffer,endOfInput);
126127
}
127128

‎netty-utils/src/test/java/org/asynchttpclient/netty/util/ByteBufUtilsTest.java‎renamed to ‎netty-utils/src/test/java/org/asynchttpclient/netty/util/Utf8ByteBufCharsetDecoderTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
importorg.testng.annotations.Test;
2222

23-
publicclassByteBufUtilsTest {
23+
publicclassUtf8ByteBufCharsetDecoderTest {
2424

2525
@Test
2626
publicvoidtestByteBuf2BytesHasBackingArray() {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp