From 3c89c9ad74e55e3aca1a36a4341202e31ceecbf7 Mon Sep 17 00:00:00 2001 From: zhuangchong <37063904+zhuangchong@users.noreply.github.com> Date: Wed, 18 Nov 2020 14:30:30 +0800 Subject: [PATCH 1/2] [Improvement-3471][common] JSONUtils.toMap It is not necessary to check whether the JSON method is empty again. #3471 (#3481) * JSONUtils.toMap call improvement. --- .../alert/utils/EnterpriseWeChatUtils.java | 6 +---- .../api/service/DataSourceService.java | 22 +++++++++---------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java index ef1022755f..b3cb5f7c4e 100644 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java +++ b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java @@ -104,11 +104,7 @@ public class EnterpriseWeChatUtils { } Map map = JSONUtils.toMap(resp); - if (map != null) { - return map.get("access_token"); - } else { - return null; - } + return map == null ? null : map.get("access_token"); } finally { httpClient.close(); } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java index d21a64c4b3..1fa0494d13 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java @@ -539,19 +539,17 @@ public class DataSourceService extends BaseService { (type == DbType.HIVE || type == DbType.SPARK)) { parameterMap.put(Constants.PRINCIPAL, principal); } - if (other != null && !"".equals(other)) { - Map map = JSONUtils.toMap(other); - if (map.size() > 0) { - StringBuilder otherSb = new StringBuilder(); - for (Map.Entry entry : map.entrySet()) { - otherSb.append(String.format("%s=%s%s", entry.getKey(), entry.getValue(), separator)); - } - if (!Constants.DB2.equals(type.name())) { - otherSb.deleteCharAt(otherSb.length() - 1); - } - parameterMap.put(Constants.OTHER, otherSb); - } + Map map = JSONUtils.toMap(other); + if (map != null) { + StringBuilder otherSb = new StringBuilder(); + for (Map.Entry entry: map.entrySet()) { + otherSb.append(String.format("%s=%s%s", entry.getKey(), entry.getValue(), separator)); + } + if (!Constants.DB2.equals(type.name())) { + otherSb.deleteCharAt(otherSb.length() - 1); + } + parameterMap.put(Constants.OTHER, otherSb); } if (logger.isDebugEnabled()) { From 9232c0e46f32ac8025d9953aff366122b7096926 Mon Sep 17 00:00:00 2001 From: yangquan Date: Wed, 18 Nov 2020 19:19:45 +0800 Subject: [PATCH 2/2] [Fix-4054][Api] Fix The last week of the month for adding/editing timing, preview and save timing will report an error --- .../src/js/module/components/crontab/source/_times/day.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/day.vue b/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/day.vue index 1efc0224ad..4e65b1cc4b 100755 --- a/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/day.vue +++ b/dolphinscheduler-ui/src/js/module/components/crontab/source/_times/day.vue @@ -352,8 +352,8 @@ }, monthLastWeeksVal (val) { if (this.radioDay === 'monthLastWeeks') { - this.weekValue = `?` - this.dayValue = val + this.weekValue = val + this.dayValue = `?` } }, WkmonthNumWeeksWeekVal (val) {