From f28c58044ebd7c9c5a73659ad54af1d16ac1c364 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 13 Apr 2016 13:40:14 -0700 Subject: [PATCH] Fix #437 - updates to NPE prevention --- .../websocket/jsr356/messages/TextPartialMessage.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/TextPartialMessage.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/TextPartialMessage.java index 8edca37d4a2..dc17a7935cc 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/TextPartialMessage.java +++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/TextPartialMessage.java @@ -47,8 +47,13 @@ public class TextPartialMessage implements MessageAppender @Override public void appendFrame(ByteBuffer payload, boolean isLast) throws IOException { + String msg = null; + // No decoders for Partial messages per JSR-356 (PFD1 spec) - partialHandler.onMessage(BufferUtil.toUTF8String(payload.slice()),isLast); + if (payload != null) + msg = BufferUtil.toUTF8String(payload.slice()); + + partialHandler.onMessage(msg, isLast); } @Override