You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by zh...@apache.org on 2022/11/08 06:06:02 UTC

[rocketmq-connect] branch master updated: [ISSUE #369] Fix plugin compareAndSwapLoaders npe (#370)

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

zhoubo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-connect.git


The following commit(s) were added to refs/heads/master by this push:
     new aab4d5d7 [ISSUE #369] Fix plugin compareAndSwapLoaders npe (#370)
aab4d5d7 is described below

commit aab4d5d70f6d6977aa4fa99638ea2979a97aa217
Author: Slideee <ye...@corp.netease.com>
AuthorDate: Tue Nov 8 14:05:57 2022 +0800

    [ISSUE #369] Fix plugin compareAndSwapLoaders npe (#370)
---
 .../apache/rocketmq/connect/runtime/controller/isolation/Plugin.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/controller/isolation/Plugin.java b/rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/controller/isolation/Plugin.java
index 89efc9c1..6c5363e6 100644
--- a/rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/controller/isolation/Plugin.java
+++ b/rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/controller/isolation/Plugin.java
@@ -41,6 +41,7 @@ public class Plugin {
 
     private static final Logger log = LoggerFactory.getLogger(Plugin.class);
     private final DelegatingClassLoader delegatingLoader;
+
     public Plugin(List<String> pluginLocations) {
         delegatingLoader = newDelegatingClassLoader(pluginLocations);
         delegatingLoader.initLoaders();
@@ -48,7 +49,7 @@ public class Plugin {
 
     public static ClassLoader compareAndSwapLoaders(ClassLoader loader) {
         ClassLoader current = Thread.currentThread().getContextClassLoader();
-        if (!current.equals(loader)) {
+        if (null == current || !current.equals(loader)) {
             Thread.currentThread().setContextClassLoader(loader);
         }
         return current;