-
Notifications
You must be signed in to change notification settings - Fork 430
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
Ratis 952. Avoid NPE #461
Conversation
- 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
022650b
to
ca6c716
Compare
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. |
@softgitron , thanks a lot for contributing to Ratis!
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)? |
Yes, please file a JIRA per PR. Subtasks of RATIS-952 are good. Thanks! |
What changes were proposed in this pull request?
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.