Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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;

Expand All @@ -36,7 +37,7 @@ public ClientResponse<FullResponseHolder> handleResponse(HttpResponse response)
null
);

holder.addChunk(response.getContent().array());
holder.addChunk(getContentBytes(response.getContent()));

return ClientResponse.unfinished(
holder
Expand All @@ -55,7 +56,7 @@ public ClientResponse<FullResponseHolder> handleChunk(
return ClientResponse.finished(null);
}

holder.addChunk(chunk.getContent().array());
holder.addChunk(getContentBytes(chunk.getContent()));
return response;
}

Expand All @@ -72,4 +73,11 @@ public void exceptionCaught(
{
// 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;
}
}