-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
NullPointerException in HttpPostRequestEncoder encodeNextChunkUrlEncoded #9351
Copy link
Copy link
Closed
Description
Expected behavior
No NullPointerException.
Actual behavior
When given a certain input size, the encodeNextChunkUrlEncoded throws a NullPointerException in the following line
if (currentBuffer.readableBytes() >= HttpPostBodyUtil.chunkSize) {
because the currentBuffer is null (which was set to the delimiter which was null). There seems to have been a similar issue in the past: #5478.
Steps to reproduce / Minimal yet complete reproducer code (or URL to code)
@Test
public void testWriteChunkedContent() throws Exception {
EmbeddedChannel ch = new EmbeddedChannel(new ChunkedWriteHandler());
HttpRequest req = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/");
HttpPostRequestEncoder encoder = new HttpPostRequestEncoder(req, false);
int length = 8077 + 8096;
char[] array = new char[length];
Arrays.fill(array, 'a');
String longText = new String(array);
encoder.addBodyAttribute("data", longText);
encoder.addBodyAttribute("moreData", "abcd");
HttpRequest finalRequest = encoder.finalizeRequest();
ch.writeOutbound(finalRequest);
ch.writeOutbound(encoder);
ch.flushOutbound();
}
Netty version
4.1
JVM version (e.g. java -version)
java version "1.8.0_111"
OS version (e.g. uname -a)
Darwin Kernel Version 18.6.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels