Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] fix can not use empty collection as query params in eclipselink #1900

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading