From 6fcc81e79580e5a6148f5ad753e61de491c15802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E8=BF=9B=E5=B1=B1?= Date: Tue, 3 Sep 2024 09:36:41 +0800 Subject: [PATCH 1/3] [fix] fix byte type npe. --- .../apache/hertzbeat/manager/service/impl/TagServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/TagServiceImpl.java b/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/TagServiceImpl.java index 02ac69febf6..3892476c7d5 100644 --- a/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/TagServiceImpl.java +++ b/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/TagServiceImpl.java @@ -130,7 +130,7 @@ public List listTag(Set ids) { @Override public void deleteMonitorSystemTags(Monitor monitor) { if (CollectionUtils.isNotEmpty(monitor.getTags())) { - List tags = monitor.getTags().stream().filter(tag -> tag.getType() == (byte) 0).collect(Collectors.toList()); + List tags = monitor.getTags().stream().filter(tag -> tag.getType() != null && tag.getType() == (byte) 0).collect(Collectors.toList()); tagDao.deleteAll(tags); } } From c50e62953489a721bc2eec1d89460fe47b77386a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E8=BF=9B=E5=B1=B1?= Date: Tue, 3 Sep 2024 10:22:49 +0800 Subject: [PATCH 2/3] [fix] fix byte type npe. --- .../hertzbeat/manager/service/impl/TagServiceImpl.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/TagServiceImpl.java b/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/TagServiceImpl.java index 3892476c7d5..9619a6ffb08 100644 --- a/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/TagServiceImpl.java +++ b/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/TagServiceImpl.java @@ -18,11 +18,8 @@ package org.apache.hertzbeat.manager.service.impl; import jakarta.persistence.criteria.Predicate; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Optional; -import java.util.Set; + +import java.util.*; import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; @@ -130,7 +127,7 @@ public List listTag(Set ids) { @Override public void deleteMonitorSystemTags(Monitor monitor) { if (CollectionUtils.isNotEmpty(monitor.getTags())) { - List tags = monitor.getTags().stream().filter(tag -> tag.getType() != null && tag.getType() == (byte) 0).collect(Collectors.toList()); + List tags = monitor.getTags().stream().filter(tag -> Objects.nonNull(tag.getType()) && tag.getType() == (byte) 0).collect(Collectors.toList()); tagDao.deleteAll(tags); } } From f3b9403bff8606c2d10050f614ca53fed9d54ba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E8=BF=9B=E5=B1=B1?= Date: Tue, 3 Sep 2024 10:35:08 +0800 Subject: [PATCH 3/3] [fix] fix byte type npe. --- .../hertzbeat/manager/service/impl/TagServiceImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/TagServiceImpl.java b/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/TagServiceImpl.java index 9619a6ffb08..b0508b5d74b 100644 --- a/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/TagServiceImpl.java +++ b/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/TagServiceImpl.java @@ -19,7 +19,12 @@ import jakarta.persistence.criteria.Predicate; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils;