Skip to content

Commit

Permalink
[bugfix] fix can not use empty collection as query params in eclipsel…
Browse files Browse the repository at this point in the history
…ink (#1900)

Signed-off-by: tomsun28 <[email protected]>
  • Loading branch information
tomsun28 authored May 2, 2024
1 parent 6980263 commit f86651a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private MonitorDto convert(ExportMonitorDTO exportMonitor) {
log.debug("exportMonitor.monitor{}", exportMonitor.monitor);
if (exportMonitor.monitor != null) { // Add one more null check
BeanUtils.copyProperties(exportMonitor.monitor, monitor);
if (exportMonitor.monitor.tags != null) {
if (exportMonitor.monitor.tags != null && !exportMonitor.monitor.tags.isEmpty()) {
monitor.setTags(tagService.listTag(new HashSet<>(exportMonitor.monitor.tags))
.stream()
.filter(tag -> !(tag.getName().equals(CommonConstants.TAG_MONITOR_ID) || tag.getName().equals(CommonConstants.TAG_MONITOR_NAME)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public class MonitorServiceImpl implements MonitorService {
private static final Long MONITOR_ID_TMP = 1000000000L;

public static final String HTTP = "http://";

public static final String HTTPS = "https://";
public static final String BLANK = "";
public static final String PATTERN_HTTP = "(?i)http://";
Expand Down Expand Up @@ -583,7 +584,7 @@ public void deleteMonitor(long id) throws RuntimeException {
@Transactional(rollbackFor = Exception.class)
public void deleteMonitors(Set<Long> ids) throws RuntimeException {
List<Monitor> monitors = monitorDao.findMonitorsByIdIn(ids);
if (monitors != null) {
if (!monitors.isEmpty()) {
monitorDao.deleteAll(monitors);
paramDao.deleteParamsByMonitorIdIn(ids);
Set<Long> monitorIds = monitors.stream().map(Monitor::getId).collect(Collectors.toSet());
Expand Down Expand Up @@ -750,7 +751,10 @@ public void copyMonitors(List<Long> ids) {
public void updateAppCollectJob(Job job) {
List<Monitor> monitors = monitorDao.findMonitorsByAppEquals(job.getApp())
.stream().filter(monitor -> monitor.getStatus() != CommonConstants.UN_MANAGE_CODE)
.collect(Collectors.toList());
.toList();
if (monitors.isEmpty()) {
return;
}
List<CollectorMonitorBind> monitorBinds = collectorMonitorBindDao.findCollectorMonitorBindsByMonitorIdIn(
monitors.stream().map(Monitor::getId).collect(Collectors.toSet()));
Map<Long, String> monitorIdCollectorMap = monitorBinds.stream().collect(
Expand All @@ -775,7 +779,7 @@ public void updateAppCollectJob(Job job) {
param.getParamValue(), param.getType())).collect(Collectors.toList());
List<ParamDefine> paramDefaultValue = appDefine.getParams().stream()
.filter(item -> StringUtils.hasText(item.getDefaultValue()))
.collect(Collectors.toList());
.toList();
paramDefaultValue.forEach(defaultVar -> {
if (configmaps.stream().noneMatch(item -> item.getKey().equals(defaultVar.getField()))) {
Configmap configmap = new Configmap(defaultVar.getField(), defaultVar.getDefaultValue(), (byte) 1);
Expand Down

0 comments on commit f86651a

Please sign in to comment.