From 2c0e27580fccb38aa5bb41f1937a8c17feb9fbdd Mon Sep 17 00:00:00 2001 From: Albumen Kevin Date: Thu, 14 Dec 2023 19:31:32 +0800 Subject: [PATCH] Fix potential NPE --- .../common/serialize/hessian2/Hessian2FactoryManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2FactoryManager.java b/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2FactoryManager.java index ac342926600..f397dbc4b00 100644 --- a/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2FactoryManager.java +++ b/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2FactoryManager.java @@ -23,6 +23,7 @@ import org.apache.dubbo.common.utils.StringUtils; import org.apache.dubbo.rpc.model.FrameworkModel; +import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; import com.alibaba.com.caucho.hessian.io.SerializerFactory; @@ -46,7 +47,7 @@ public Hessian2FactoryManager(FrameworkModel frameworkModel) { public SerializerFactory getSerializerFactory(ClassLoader classLoader) { SerializerFactory sticky = stickySerializerFactory; - if (sticky != null && sticky.getClassLoader().equals(classLoader)) { + if (sticky != null && Objects.equals(sticky.getClassLoader(), classLoader)) { return sticky; }