This is an automated email from the ASF dual-hosted git repository. jonwei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-druid.git
The following commit(s) were added to refs/heads/master by this push: new 951b36e BytesFullResponseHandler should only consume readableBytes of ChannelBuffer (#6270) 951b36e is described below commit 951b36e2bc7caed992a263a5e1289414b12b39da Author: Dayue Gao <dyga...@gmail.com> AuthorDate: Fri Aug 31 11:22:08 2018 +0800 BytesFullResponseHandler should only consume readableBytes of ChannelBuffer (#6270) --- .../basic/authentication/BytesFullResponseHandler.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/BytesFullResponseHandler.java b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/BytesFullResponseHandler.java index fa00a92..0f75ae2 100644 --- a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/BytesFullResponseHandler.java +++ b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/BytesFullResponseHandler.java @@ -22,6 +22,7 @@ package org.apache.druid.security.basic.authentication; import org.apache.druid.java.util.http.client.response.ClientResponse; import org.apache.druid.java.util.http.client.response.FullResponseHolder; import org.apache.druid.java.util.http.client.response.HttpResponseHandler; +import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.handler.codec.http.HttpChunk; import org.jboss.netty.handler.codec.http.HttpResponse; @@ -36,7 +37,7 @@ public class BytesFullResponseHandler implements HttpResponseHandler<FullRespons null ); - holder.addChunk(response.getContent().array()); + holder.addChunk(getContentBytes(response.getContent())); return ClientResponse.unfinished( holder @@ -55,7 +56,7 @@ public class BytesFullResponseHandler implements HttpResponseHandler<FullRespons return ClientResponse.finished(null); } - holder.addChunk(chunk.getContent().array()); + holder.addChunk(getContentBytes(chunk.getContent())); return response; } @@ -72,4 +73,11 @@ public class BytesFullResponseHandler implements HttpResponseHandler<FullRespons { // Its safe to Ignore as the ClientResponse returned in handleChunk were unfinished } + + private byte[] getContentBytes(ChannelBuffer content) + { + byte[] contentBytes = new byte[content.readableBytes()]; + content.readBytes(contentBytes); + return contentBytes; + } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org