Better message for invalid internal transport message format

closes ##6916
This commit is contained in:
Shay Banon 2014-07-18 11:24:02 +02:00
parent 792d8970e8
commit 972fa10945
1 changed files with 6 additions and 1 deletions

View File

@ -43,7 +43,12 @@ public class SizeHeaderFrameDecoder extends FrameDecoder {
int readerIndex = buffer.readerIndex();
if (buffer.getByte(readerIndex) != 'E' || buffer.getByte(readerIndex + 1) != 'S') {
throw new StreamCorruptedException("invalid internal transport message format");
// we have 6 readable bytes, show 4 (should be enough)
throw new StreamCorruptedException("invalid internal transport message format, got ("
+ Integer.toHexString(buffer.getByte(readerIndex) & 0xFF) + ","
+ Integer.toHexString(buffer.getByte(readerIndex + 1) & 0xFF) + ","
+ Integer.toHexString(buffer.getByte(readerIndex + 2) & 0xFF) + ","
+ Integer.toHexString(buffer.getByte(readerIndex + 3) & 0xFF) + ")");
}
int dataLen = buffer.getInt(buffer.readerIndex() + 2);