You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2021/02/05 10:56:21 UTC

[dubbo] branch 2.7.8.1-release updated: check serialization not null before set, too many uts to fix

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

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


The following commit(s) were added to refs/heads/2.7.8.1-release by this push:
     new acd0e8e  check serialization not null before set, too many uts to fix
acd0e8e is described below

commit acd0e8e9f4c63970e42debb229c5d5b918ffb994
Author: ken.lj <ke...@gmail.com>
AuthorDate: Fri Feb 5 18:55:05 2021 +0800

    check serialization not null before set, too many uts to fix
---
 .../main/java/org/apache/dubbo/remoting/transport/CodecSupport.java | 6 +-----
 .../main/java/org/apache/dubbo/rpc/protocol/AbstractInvoker.java    | 5 ++++-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/CodecSupport.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/CodecSupport.java
index 582eae4..8592293 100644
--- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/CodecSupport.java
+++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/CodecSupport.java
@@ -75,11 +75,7 @@ public class CodecSupport {
     }
 
     public static byte getIDByName(String name) {
-        Byte id = SERIALIZATIONNAME_ID_MAP.get(name);
-        if (id == null) {
-            throw new RuntimeException("No extension find for serialization name " + name);
-        }
-        return id;
+        return SERIALIZATIONNAME_ID_MAP.get(name);
     }
 
     public static Serialization getSerialization(URL url) {
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractInvoker.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractInvoker.java
index c06b720..2c749b4 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractInvoker.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractInvoker.java
@@ -163,7 +163,10 @@ public abstract class AbstractInvoker<T> implements Invoker<T> {
         invocation.setInvokeMode(RpcUtils.getInvokeMode(url, invocation));
         RpcUtils.attachInvocationIdIfAsync(getUrl(), invocation);
 
-        invocation.put(SERIALIZATION_ID_KEY, CodecSupport.getIDByName(getUrl().getParameter(SERIALIZATION_KEY, DEFAULT_REMOTING_SERIALIZATION)));
+        Byte serializationId = CodecSupport.getIDByName(getUrl().getParameter(SERIALIZATION_KEY, DEFAULT_REMOTING_SERIALIZATION));
+        if (serializationId != null) {
+            invocation.put(SERIALIZATION_ID_KEY, serializationId);
+        }
 
         AsyncRpcResult asyncResult;
         try {