436874 - WebSocket client throwing a NullPointer when handling a pong
+ Adding NPE guard for PONG with no payload.
This commit is contained in:
parent
bfce68e85c
commit
a41dd1caf5
|
@ -35,6 +35,7 @@ import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
import org.eclipse.jetty.util.log.Logger;
|
||||||
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
|
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
|
||||||
import org.eclipse.jetty.websocket.api.extensions.Frame;
|
import org.eclipse.jetty.websocket.api.extensions.Frame;
|
||||||
|
import org.eclipse.jetty.websocket.common.frames.ControlFrame;
|
||||||
import org.eclipse.jetty.websocket.common.message.MessageInputStream;
|
import org.eclipse.jetty.websocket.common.message.MessageInputStream;
|
||||||
import org.eclipse.jetty.websocket.common.message.MessageReader;
|
import org.eclipse.jetty.websocket.common.message.MessageReader;
|
||||||
import org.eclipse.jetty.websocket.jsr356.JsrPongMessage;
|
import org.eclipse.jetty.websocket.jsr356.JsrPongMessage;
|
||||||
|
@ -236,9 +237,18 @@ public class JsrEndpointEventDriver extends AbstractJsrEventDriver
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuffer pongBuf = ByteBuffer.allocate(buffer.remaining());
|
ByteBuffer pongBuf = null;
|
||||||
|
|
||||||
|
if (BufferUtil.isEmpty(buffer))
|
||||||
|
{
|
||||||
|
pongBuf = BufferUtil.EMPTY_BUFFER;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pongBuf = ByteBuffer.allocate(buffer.remaining());
|
||||||
BufferUtil.put(buffer,pongBuf);
|
BufferUtil.put(buffer,pongBuf);
|
||||||
BufferUtil.flipToFlush(pongBuf,0);
|
BufferUtil.flipToFlush(pongBuf,0);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Whole<PongMessage> pongHandler = (Whole<PongMessage>)wrapper.getHandler();
|
Whole<PongMessage> pongHandler = (Whole<PongMessage>)wrapper.getHandler();
|
||||||
|
|
Loading…
Reference in New Issue