Skip to content

Ratis 952. Avoid NPE #461

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

Closed
wants to merge 6 commits into from
Closed

Conversation

softgitron
Copy link
Contributor

What changes were proposed in this pull request?

  • Fix null pointer issues that were reported by SonarQube
  • Fix spotty testInstallSnapshotNotificationCount test case

Test case fix is not strictly related to the NPE fixes, but I decided to add it to this pull request. For some reason this particular test failed especially often after these changes. However I couldn't find any direct connections with the NPE fixes and the test. I think the test itself is faulty and can be fixed with slight waiting before assertions.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/RATIS-952

How was this patch tested?

Patch was tested using existing tests. In addition, couple of testcases were added in to make sure that patches work as intended.

- Fix SonarQube issues in IoUtils
- Add Awaitility dependency for easier asynchronous testing
- Use Awaitility to wait for a while to make sure there is enough time for a state sync
- Fix unused import
- Fix MetaStateMachine timerContext
@softgitron softgitron force-pushed the RATIS-952 branch 2 times, most recently from 022650b to ca6c716 Compare April 17, 2021 10:55
@softgitron softgitron marked this pull request as ready for review April 17, 2021 17:06
@softgitron
Copy link
Contributor Author

If anyone got time to review my code, I'm open for suggestions and improvements. I tried my best to fix all the potential NPE issues without breaking anything critical, but the Ratis codebase is fairly complex so I may have made miss judgement at some point.

@szetszwo
Copy link
Contributor

@softgitron , thanks a lot for contributing to Ratis!

Test case fix is not strictly related to the NPE fixes, but I decided to add it to this pull request.

Please focus on a single aspect in each pull request. Please feel free to file multiple pull requests if there are different changes.

A single big pull request is hard to review and easy to make mistakes.

Indeed, it is not clear what does "Avoid NPE" mean. Which part (which class) of it try to fix? I suggest to start with a single class first.

@softgitron
Copy link
Contributor Author

@softgitron , thanks a lot for contributing to Ratis!

Test case fix is not strictly related to the NPE fixes, but I decided to add it to this pull request.

Please focus on a single aspect in each pull request. Please feel free to file multiple pull requests if there are different changes.

A single big pull request is hard to review and easy to make mistakes.

Indeed, it is not clear what does "Avoid NPE" mean. Which part (which class) of it try to fix? I suggest to start with a single class first.

Thanks for a reply @szetszwo! Yea, I admit that this PR ended up being way too fat, but the original fat Jira-ticket tempted me to do it this way. This PR actually fixes 8 different NPE issues in several classes reported by SonarQube and one flake test case.

I will close this PR for now and split it into 5-8 separate PRs in the following days. Would you also like to have separate Jira-tickets for all PRs or would sub tasks for RATIS-952 be sufficient (naturally flake test case should have its own Jira)?

@softgitron softgitron closed this Apr 19, 2021
@szetszwo
Copy link
Contributor

Yes, please file a JIRA per PR. Subtasks of RATIS-952 are good. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants