Browse Source

[Improvement-3471][common] JSONUtils.toMap It is not necessary to check whether the JSON method is empty again. #3471 (#3481)

* JSONUtils.toMap call improvement.
pull/3/MERGE
zhuangchong 4 years ago committed by GitHub
parent
commit
3c89c9ad74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java
  2. 6
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java

6
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java

@ -104,11 +104,7 @@ public class EnterpriseWeChatUtils {
}
Map<String, String> 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();
}

6
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java

@ -539,9 +539,9 @@ public class DataSourceService extends BaseService {
(type == DbType.HIVE || type == DbType.SPARK)) {
parameterMap.put(Constants.PRINCIPAL, principal);
}
if (other != null && !"".equals(other)) {
Map<String, String> map = JSONUtils.toMap(other);
if (map.size() > 0) {
if (map != null) {
StringBuilder otherSb = new StringBuilder();
for (Map.Entry<String, String> entry: map.entrySet()) {
otherSb.append(String.format("%s=%s%s", entry.getKey(), entry.getValue(), separator));
@ -552,8 +552,6 @@ public class DataSourceService extends BaseService {
parameterMap.put(Constants.OTHER, otherSb);
}
}
if (logger.isDebugEnabled()) {
logger.info("parameters map:{}", JSONUtils.toJsonString(parameterMap));
}

Loading…
Cancel
Save