gabrywu commented on a change in pull request #2872:
URL: 
https://github.com/apache/incubator-dolphinscheduler/pull/2872#discussion_r435922605



##########
File path: 
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java
##########
@@ -161,15 +159,15 @@
             return result;
         }
         //check password,if the password is not updated, set to the old 
password.
-        JSONObject paramObject = JSON.parseObject(parameter);
-        String password = paramObject.getString(Constants.PASSWORD);
+        ObjectNode paramObject = JSONUtils.parseObject(parameter);
+        String password = paramObject.path(Constants.PASSWORD).asText();
         if (StringUtils.isBlank(password)) {
             String oldConnectionParams = dataSource.getConnectionParams();
-            JSONObject oldParams = JSON.parseObject(oldConnectionParams);
-            paramObject.put(Constants.PASSWORD, 
oldParams.getString(Constants.PASSWORD));
+            ObjectNode oldParams = JSONUtils.parseObject(oldConnectionParams);
+            paramObject.put(Constants.PASSWORD, 
oldParams.path(Constants.PASSWORD).asText());
         }
         // connectionParams json
-        String connectionParams = paramObject.toJSONString();
+        String connectionParams = JSONUtils.toJsonString(paramObject);

Review comment:
       paramObject is ObjectNode ,why not use toString directly ?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to