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

gongchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git


The following commit(s) were added to refs/heads/master by this push:
     new 133a783bb [bugfix] fix ConnectionCommonCache possible npe (#1959)
133a783bb is described below

commit 133a783bb4eac83e8b7abeac4770379ffd353503
Author: crossoverJie <[email protected]>
AuthorDate: Sat May 11 10:43:20 2024 +0800

    [bugfix] fix ConnectionCommonCache possible npe (#1959)
---
 .../collector/collect/common/cache/ConnectionCommonCache.java          | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/collector/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java
 
b/collector/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java
index 6b2f0b9da..f5d5f3988 100644
--- 
a/collector/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java
+++ 
b/collector/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java
@@ -219,6 +219,9 @@ public class ConnectionCommonCache<T, C extends 
AbstractConnection<?>> {
         timeoutMap.remove(key);
         C value = cacheMap.remove(key);
         try {
+            if (value == null) {
+                return;
+            }
             value.close();
         } catch (Exception e) {
             log.error("connection close error: {}.", e.getMessage(), e);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to