Correctly respect readerIndex of buffer when dumping.

Motivation:

The current dumping code does not respect the readerIndex and so logs incorrect.

Modifications:

Respect readerIndex of ByteBuf

Result:

Correctly log content of buffer.
This commit is contained in:
Norman Maurer 2015-06-03 22:29:28 +02:00
parent dec53cff86
commit 7f889be48b

View File

@ -417,7 +417,7 @@ public class LoggingHandler extends ChannelHandlerAdapter {
// Dump the rows which have 16 bytes.
for (int row = 0; row < fullRows; row ++) {
int rowStartIndex = row << 4;
int rowStartIndex = (row << 4) + startIndex;
// Per-row prefix.
appendHexDumpRowPrefix(dump, row, rowStartIndex);
@ -438,7 +438,7 @@ public class LoggingHandler extends ChannelHandlerAdapter {
// Dump the last row which has less than 16 bytes.
if (remainder != 0) {
int rowStartIndex = fullRows << 4;
int rowStartIndex = (fullRows << 4) + startIndex;
appendHexDumpRowPrefix(dump, fullRows, rowStartIndex);
// Hex dump