From e9eb9ef1c3b86b31ce61b2103cb0044c915614ed Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Wed, 8 May 2019 15:53:27 +0800 Subject: [PATCH] [DUBBO-3991]: port #3568 into main trunk --- .../java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java index 38650c2b2ef..bc8c7470184 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java @@ -73,12 +73,13 @@ protected Object decodeBody(Channel channel, InputStream is, byte[] header) thro byte status = header[3]; res.setStatus(status); try { - ObjectInput in = CodecSupport.deserialize(channel.getUrl(), is, proto); if (status == Response.OK) { Object data; if (res.isHeartbeat()) { + ObjectInput in = CodecSupport.deserialize(channel.getUrl(), is, proto); data = decodeHeartbeatData(channel, in); } else if (res.isEvent()) { + ObjectInput in = CodecSupport.deserialize(channel.getUrl(), is, proto); data = decodeEventData(channel, in); } else { DecodeableRpcResult result; @@ -97,6 +98,7 @@ protected Object decodeBody(Channel channel, InputStream is, byte[] header) thro } res.setResult(data); } else { + ObjectInput in = CodecSupport.deserialize(channel.getUrl(), is, proto); res.setErrorMessage(in.readUTF()); } } catch (Throwable t) {