-
In your HttpUtil.parseHttpRequest() method:
the variable bodyEndIndex should be bodyStartIndex + httpHeaders.contentLength + 1 rather than bodyStartIndex + httpHeaders.contentLength
-
In your Message.writePartialMessageToMessage method:
the variable startIndexOfPartialMessage should just be endIndex + 1 rather than message.offset + endIndex.
the variable lengthOfPartialMessage should be (message.offset + message.length) - endIndex + 1 rather than (message.offset + message.length) - endIndex
-
I got a NPE when invoking the HttpMessageReader.read().The code snippet is shown below:
Message message = this.messageBuffer.getMessage; //the return message might be null
message.metadata = new HttpHeaders(); //the NPE occurs here
To solve the problem,I add some code in your QueueIntFlip.take() method:
if(!flipped){
//add this if
if(readPos == capacity) {
readPos = 0;
}
if(readPos < writePos){
return elements[readPos++];
} else {
return -1;
}
}
In your
HttpUtil.parseHttpRequest()method:the variable
bodyEndIndexshould bebodyStartIndex + httpHeaders.contentLength + 1rather thanbodyStartIndex + httpHeaders.contentLengthIn your
Message.writePartialMessageToMessagemethod:the variable
startIndexOfPartialMessageshould just beendIndex + 1rather thanmessage.offset + endIndex.the variable
lengthOfPartialMessageshould be(message.offset + message.length) - endIndex + 1rather than(message.offset + message.length) - endIndexI got a NPE when invoking the
HttpMessageReader.read().The code snippet is shown below:To solve the problem,I add some code in your
QueueIntFlip.take()method: