-
Notifications
You must be signed in to change notification settings - Fork 8.9k
feature: add jackson json parser and gson json parser for tcc business action context #5352
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
Conversation
integration-tx-api/src/main/java/io/seata/integration/tx/api/util/JsonUtil.java
Show resolved
Hide resolved
| */ | ||
| public class JsonParserFactory { | ||
|
|
||
| private static Map<String, JsonParser> JSON_PARSER_INSTANCES = new ConcurrentHashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static final
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use ConcurrentHashMap ?
integration-tx-api/src/main/java/io/seata/integration/tx/api/json/JsonParserFactory.java
Outdated
Show resolved
Hide resolved
integration-tx-api/src/main/java/io/seata/integration/tx/api/util/JsonUtil.java
Outdated
Show resolved
Hide resolved
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## 2.x #5352 +/- ##
============================================
+ Coverage 48.54% 48.73% +0.19%
- Complexity 4300 4311 +11
============================================
Files 771 775 +4
Lines 27350 27372 +22
Branches 3410 3408 -2
============================================
+ Hits 13277 13340 +63
+ Misses 12669 12627 -42
- Partials 1404 1405 +1
|
funky-eyes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| return this.mapper.writeValueAsString(object); | ||
| } catch (JsonProcessingException e) { | ||
| LOGGER.error("jackson toJSONString exception, {}", e.getMessage(), e); | ||
| throw new RuntimeException(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 异常抛出了,就不要在日志里记录堆栈。会导致重复记录;
- 另外,单独加一个JSON解析异常类吧。多种JSON解析方式失败后,都抛出同一种异常。
| if (Objects.isNull(text) || Objects.isNull(clazz)) { | ||
| return null; | ||
| } | ||
| String jsonParseName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here has a bug and may change to
String jsonParseName = text.startsWith(Constants.JACKSON_JSON_TEXT_PREFIX) ?
Constants.JACKSON_JSON_PARSER_NAME : CONFIG_JSON_PARSER_NAME;
l81893521
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the configuration item into the configuration file.
wangliang181230
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Support for Spring configuration is currently environment first, but should existing PropertiesBeans be consistent? |
…s action context (apache#5352)
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
fixes #5011
fixes #5334
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews