Skip to content

Commit

Permalink
[bugfix] tag with empty value shouldn't transform to tag: (#2025)
Browse files Browse the repository at this point in the history
Co-authored-by: tomsun28 <tomsun28@outlook.com>
  • Loading branch information
JavaProgrammerLB and tomsun28 committed May 22, 2024
1 parent 34b9581 commit 7a670e8
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.hertzbeat.common.entity.manager.Monitor;
import org.apache.hertzbeat.common.entity.manager.Tag;
import org.apache.hertzbeat.manager.dao.TagDao;
Expand Down Expand Up @@ -55,6 +56,7 @@ public void addTags(List<Tag> tags) {
public void modifyTag(Tag tag) {
Optional<Tag> tagOptional = tagDao.findById(tag.getId());
if (tagOptional.isPresent()) {
tag.setTagValue(StringUtils.isEmpty(tag.getTagValue()) ? null : tag.getTagValue());
tagDao.save(tag);
} else {
throw new IllegalArgumentException("The tag is not existed");
Expand Down

0 comments on commit 7a670e8

Please sign in to comment.