Skip to content
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

Replace the fastjson of the ArcticMetaStore class in ams-server with jackson #1392

Closed
wants to merge 4 commits into from

Conversation

329724814
Copy link

Why are the changes needed?

There are many high-risk vulnerabilities in the previous version of fastjosn,We need to replace fastjson with jackson

Brief change log

Replace the fastjson of the ArcticMetaStore class in ams-server with jackson,

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before making a pull request

Documentation

  • Does this pull request introduces a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@github-actions github-actions bot added module:ams-server Ams server module module:ams-dashboard Ams dashboard module labels Apr 24, 2023
@codecov
Copy link

codecov bot commented Apr 24, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.19 ⚠️

Comparison is base (a6730a2) 44.01% compared to head (a6dabc2) 43.82%.

❗ Current head a6dabc2 differs from pull request most recent head 9da50c7. Consider uploading reports for the commit 9da50c7 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1392      +/-   ##
============================================
- Coverage     44.01%   43.82%   -0.19%     
+ Complexity      541      539       -2     
============================================
  Files            46       46              
  Lines          4276     4276              
  Branches        502      502              
============================================
- Hits           1882     1874       -8     
- Misses         2192     2206      +14     
+ Partials        202      196       -6     
Flag Coverage Δ
trino 43.82% <ø> (-0.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.


public static Boolean getBoolean(JsonNode jsonNode, String fieldName){
if(jsonNode == null){
throw new NullPointerException();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use Preconditions.checkNotNull

if(jsonNode == null){
throw new NullPointerException();
}
if(jsonNode.get(fieldName) == null){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should create a local variable like this: JsonNode jsonNode = jsonNode.get(fieldName), because the jsonNode.get(fieldName) method is being called twice.

for(JsonNode jsonNode : catalogs){
System.out.println(jsonNode.get("name").asText());
}
System.out.println(systemConfig.has("arctic.ams.expire.thread.pool-size"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot simply output at this point, we need to assert the correctness of the value. You can refer to other unit tests for how to do this.


@Test
public void jacksonTest(){
String configPath = System.getProperty("user.dir") + "/src/test/resources/test.yaml";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can find this file from classpath

@zhoujinsong
Copy link
Contributor

@329724814 Thank you for your outstanding work!

Since the PR mainly involves changes to the AMS module, I suggest waiting for #1372 to be resolved before merging this PR, otherwise, there may be many conflicts.

@zhoujinsong zhoujinsong linked an issue Apr 26, 2023 that may be closed by this pull request
3 tasks
@baiyangtx
Copy link
Contributor

Cloud you please to handle the merge conflict with master branch? @329724814

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:ams-dashboard Ams dashboard module module:ams-server Ams server module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement]: Replace fastjson to jackson
4 participants