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

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


The following commit(s) were added to refs/heads/3.2 by this push:
     new 83240f5083 Fix npe occurs during client graceful offline. (#12190)
83240f5083 is described below

commit 83240f5083833f502070d2fc2aa0cf4d0b04a1e4
Author: huazhongming <[email protected]>
AuthorDate: Thu Apr 27 11:51:39 2023 +0800

    Fix npe occurs during client graceful offline. (#12190)
    
    Signed-off-by: crazyhzm <[email protected]>
---
 .../org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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 90b32cdf87..ef3b89bb31 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
@@ -124,7 +124,14 @@ public class DecodeableRpcResult extends AppResponse 
implements Codec, Decodeabl
         if (!hasDecoded && channel != null && inputStream != null) {
             try {
                 if (invocation != null) {
-                    Configuration systemConfiguration = 
ConfigurationUtils.getSystemConfiguration(channel.getUrl().getScopeModel());
+                    Configuration systemConfiguration = null;
+                    try {
+                        systemConfiguration = 
ConfigurationUtils.getSystemConfiguration(channel.getUrl().getScopeModel());
+                    } catch (Exception e) {
+                        // Because the Environment may be destroyed during the 
offline process, the configuration cannot be obtained.
+                        // Exceptions are ignored here, and normal decoding is 
guaranteed.
+                    }
+
                     if (systemConfiguration == null || 
systemConfiguration.getBoolean(SERIALIZATION_SECURITY_CHECK_KEY, true)) {
                         Object serializationTypeObj = 
invocation.get(SERIALIZATION_ID_KEY);
                         if (serializationTypeObj != null) {

Reply via email to