From 0b6bd70b8d1e7b7cd4d82aa2e0cbfd5e0323d440 Mon Sep 17 00:00:00 2001 From: Jiwei Guo Date: Tue, 20 Feb 2024 00:09:14 +0800 Subject: [PATCH] [fix][test] Fix Thread.getThreadGroup().getName() NPE (#22070) --- .../org/apache/pulsar/tests/ThreadLeakDetectorListener.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buildtools/src/main/java/org/apache/pulsar/tests/ThreadLeakDetectorListener.java b/buildtools/src/main/java/org/apache/pulsar/tests/ThreadLeakDetectorListener.java index 98ac0ae2c2776..0757730423688 100644 --- a/buildtools/src/main/java/org/apache/pulsar/tests/ThreadLeakDetectorListener.java +++ b/buildtools/src/main/java/org/apache/pulsar/tests/ThreadLeakDetectorListener.java @@ -177,7 +177,8 @@ private static boolean shouldSkipThread(Thread thread) { return true; } // skip Testcontainers threads - if (thread.getThreadGroup() != null && "testcontainers".equals(thread.getThreadGroup().getName())) { + final ThreadGroup threadGroup = thread.getThreadGroup(); + if (threadGroup != null && "testcontainers".equals(threadGroup.getName())) { return true; } String threadName = thread.getName();