You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2021/10/26 10:10:53 UTC
[GitHub] [dolphinscheduler] aCodingAddict opened a new issue #6606: [Bug] [common] JSONUtils#getNodeString get a value of type string with quotes
aCodingAddict opened a new issue #6606:
URL: https://github.com/apache/dolphinscheduler/issues/6606
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in JSONUtils:
`
public static String getNodeString(String json, String nodeName) {
try {
JsonNode rootNode = objectMapper.readTree(json);
return rootNode.has(nodeName) ? rootNode.get(nodeName).toString() : "";
} catch (IOException e) {
return "";
}
}
`
If the field value is a string, the result will be quoted.
So far it's just "localParams" using this function,
I think, JsonNodeType judgment is missing from JSONUtils#getNodeString,
String type can consider using JsonNode#asText instead of JsonNode#toString.
### What you expected to happen
A value of type string is changed during access
### How to reproduce
HashMap<String, Object> map = new HashMap<>();
map.put("localParams", "123");
map.put("test", 123);
// {"test":123,"localParams":"123"}
String json = JSONUtils.toJsonString(map);
String localParams = JSONUtils.getNodeString(json, "localParams");
System.out.println(localParams); // "123"
System.out.println("123".equals(localParams)); // false
String localParams1 = objectMapper.readTree(json).get("localParams").asText();
System.out.println("123".equals(localParams1)); // true
### Anything else
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
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.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] github-actions[bot] commented on issue #6606: [Bug] [common] JSONUtils#getNodeString get a value of type string with quotes
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #6606:
URL: https://github.com/apache/dolphinscheduler/issues/6606#issuecomment-951787468
Hi:
* Thank you for your feedback, we have received your issue, Please wait patiently for a reply.
* In order for us to understand your request as soon as possible, please provide detailed information、version or pictures.
* If you haven't received a reply for a long time, you can subscribe to the developer's email,Mail subscription steps reference https://dolphinscheduler.apache.org/zh-cn/community/development/subscribe.html ,Then write the issue URL in the email content and send question to dev@dolphinscheduler.apache.org.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] ruanwenjun commented on issue #6606: [Bug] [common] JSONUtils#getNodeString get a value of type string with quotes
Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on issue #6606:
URL: https://github.com/apache/dolphinscheduler/issues/6606#issuecomment-952481420
Yes, `objectMapper.readTree(json).get("localParams") ` will get the json string.
In this case, `"\"123\"".equals(localParams) ` will return true. this might cause problem in some case.
And I haven't seen this method has been used in project, so it might be better to remove this method. Are you interested in submit a pr?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] aCodingAddict commented on issue #6606: [Bug] [common] JSONUtils#getNodeString get a value of type string with quotes
Posted by GitBox <gi...@apache.org>.
aCodingAddict commented on issue #6606:
URL: https://github.com/apache/dolphinscheduler/issues/6606#issuecomment-952505296
this method is only used to get "localParams" or "dependence" from taskParams in TaskDefinition, the values of both fields are collections in the dev branch,so should i try modifying it instead of deleting it?
@ruanwenjun
If you decide to modify or delete it, I would be happy to submit one pr.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] ruanwenjun closed issue #6606: [Bug] [common] JSONUtils#getNodeString get a value of type string with quotes
Posted by GitBox <gi...@apache.org>.
ruanwenjun closed issue #6606:
URL: https://github.com/apache/dolphinscheduler/issues/6606
--
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.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org