Skip to content

Commit 0e886a9

Browse files
qixiaobobeiwei30
authored andcommitted
Dubbo throws exception when use java serializer (#4530)
* Dubbo throws exception when use java serializer issues: #3951 #3698 * Dubbo throws exception when use java serializer issues: #3951 #3698 fix travis-ci UnusedImports
1 parent f932569 commit 0e886a9

File tree

1 file changed

+5
-8
lines changed
  • dubbo-rpc/dubbo-rpc-dubbo/src/main/java/com/alibaba/dubbo/rpc/protocol/dubbo

1 file changed

+5
-8
lines changed

dubbo-rpc/dubbo-rpc-dubbo/src/main/java/com/alibaba/dubbo/rpc/protocol/dubbo/DubboCodec.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.alibaba.dubbo.common.io.UnsafeByteArrayInputStream;
2323
import com.alibaba.dubbo.common.logger.Logger;
2424
import com.alibaba.dubbo.common.logger.LoggerFactory;
25-
import com.alibaba.dubbo.common.serialize.ObjectInput;
2625
import com.alibaba.dubbo.common.serialize.ObjectOutput;
2726
import com.alibaba.dubbo.common.utils.ReflectUtils;
2827
import com.alibaba.dubbo.common.utils.StringUtils;
@@ -73,13 +72,12 @@ protected Object decodeBody(Channel channel, InputStream is, byte[] header) thro
7372
byte status = header[3];
7473
res.setStatus(status);
7574
try {
76-
ObjectInput in = CodecSupport.deserialize(channel.getUrl(), is, proto);
7775
if (status == Response.OK) {
7876
Object data;
7977
if (res.isHeartbeat()) {
80-
data = decodeHeartbeatData(channel, in);
78+
data = decodeHeartbeatData(channel, CodecSupport.deserialize(channel.getUrl(), is, proto));
8179
} else if (res.isEvent()) {
82-
data = decodeEventData(channel, in);
80+
data = decodeEventData(channel, CodecSupport.deserialize(channel.getUrl(), is, proto));
8381
} else {
8482
DecodeableRpcResult result;
8583
if (channel.getUrl().getParameter(
@@ -97,7 +95,7 @@ protected Object decodeBody(Channel channel, InputStream is, byte[] header) thro
9795
}
9896
res.setResult(data);
9997
} else {
100-
res.setErrorMessage(in.readUTF());
98+
res.setErrorMessage(CodecSupport.deserialize(channel.getUrl(), is, proto).readUTF());
10199
}
102100
} catch (Throwable t) {
103101
if (log.isWarnEnabled()) {
@@ -117,11 +115,10 @@ protected Object decodeBody(Channel channel, InputStream is, byte[] header) thro
117115
}
118116
try {
119117
Object data;
120-
ObjectInput in = CodecSupport.deserialize(channel.getUrl(), is, proto);
121118
if (req.isHeartbeat()) {
122-
data = decodeHeartbeatData(channel, in);
119+
data = decodeHeartbeatData(channel, CodecSupport.deserialize(channel.getUrl(), is, proto));
123120
} else if (req.isEvent()) {
124-
data = decodeEventData(channel, in);
121+
data = decodeEventData(channel, CodecSupport.deserialize(channel.getUrl(), is, proto));
125122
} else {
126123
DecodeableRpcInvocation inv;
127124
if (channel.getUrl().getParameter(

0 commit comments

Comments
 (0)