Fixed NPE in WebSocket00FrameDecoder if end couldn't be found in text frame
Motivation: When we receive an incomplete WebSocketFrame we need to make sure to wait for more data. Because we not did this we could produce a NPE. Modification: Make sure we not try to add null into the RecyclableArrayList Result: no more NPE on incomplete frames.
This commit is contained in:
parent
7e76cbd689
commit
d8a78424b3
@ -62,12 +62,17 @@ public class WebSocket00FrameDecoder extends ReplayingDecoder<Void> implements W
|
|||||||
|
|
||||||
// Decode a frame otherwise.
|
// Decode a frame otherwise.
|
||||||
byte type = in.readByte();
|
byte type = in.readByte();
|
||||||
|
WebSocketFrame frame;
|
||||||
if ((type & 0x80) == 0x80) {
|
if ((type & 0x80) == 0x80) {
|
||||||
// If the MSB on type is set, decode the frame length
|
// If the MSB on type is set, decode the frame length
|
||||||
out.add(decodeBinaryFrame(ctx, type, in));
|
frame = decodeBinaryFrame(ctx, type, in);
|
||||||
} else {
|
} else {
|
||||||
// Decode a 0xff terminated UTF-8 string
|
// Decode a 0xff terminated UTF-8 string
|
||||||
out.add(decodeTextFrame(ctx, in));
|
frame = decodeTextFrame(ctx, in);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frame != null) {
|
||||||
|
out.add(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user