You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/08/19 11:29:47 UTC

[dubbo] 02/04: fix NPE on serialization checking when request timed out (#8547)

This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.0.2.1-release
in repository https://gitbox.apache.org/repos/asf/dubbo.git

commit a1b6658be4bb6b04feb7f89509c78dddc5e5bccd
Author: ken.lj <ke...@gmail.com>
AuthorDate: Thu Aug 19 18:49:39 2021 +0800

    fix NPE on serialization checking when request timed out (#8547)
---
 .../apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java
index cb7a41a..8c2f671 100644
--- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java
+++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java
@@ -118,11 +118,13 @@ public class DecodeableRpcResult extends AppResponse implements Codec, Decodeabl
     public void decode() throws Exception {
         if (!hasDecoded && channel != null && inputStream != null) {
             try {
-                if (ConfigurationUtils.getSystemConfiguration().getBoolean(SERIALIZATION_SECURITY_CHECK_KEY, true)) {
-                    Object serializationType_obj = invocation.get(SERIALIZATION_ID_KEY);
-                    if (serializationType_obj != null) {
-                        if ((byte) serializationType_obj != serializationType) {
-                            throw new IOException("Unexpected serialization id:" + serializationType + " received from network, please check if the peer send the right id.");
+                if (invocation != null) {
+                    if (ConfigurationUtils.getSystemConfiguration().getBoolean(SERIALIZATION_SECURITY_CHECK_KEY, true)) {
+                        Object serializationType_obj = invocation.get(SERIALIZATION_ID_KEY);
+                        if (serializationType_obj != null) {
+                            if ((byte) serializationType_obj != serializationType) {
+                                throw new IOException("Unexpected serialization id:" + serializationType + " received from network, please check if the peer send the right id.");
+                            }
                         }
                     }
                 }