Repository navigation
RATIS-2769. Improve null handling and tests flagged by SonarCloud - #1656
Merged
Merged
Conversation
szetszwo
reviewed
Oct 22, 2026
szetszwo
left a comment
Contributor
There was a problem hiding this comment.
@slfan1989 , thanks for working on this! Just a minor comment inlined.
Comment on lines
-84
to
-86
| final int n = subSize.getSizeInt(); | ||
| final ByteString bytes = Objects.requireNonNull(Message.toByteString(message), "message content == null"); | ||
| final MessageOutputStream out = stream(); | ||
| final ByteString bytes = Message.toByteString(message); |
Contributor
There was a problem hiding this comment.
Let's check null at the first line:
public CompletableFuture<RaftClientReply> streamAsync(Message message, SizeInBytes subSize) {
Objects.requireNonNull(message, "message == null");
final ByteString bytes = Objects.requireNonNull(Message.toByteString(message), "message content == null");
Contributor
Author
There was a problem hiding this comment.
Thanks @szetszwo for the review! Updated to check message for null on the first line.
szetszwo
approved these changes
Oct 22, 2026
szetszwo
left a comment
Contributor
There was a problem hiding this comment.
+1 the change looks good.
Contributor
Author
Thanks @szetszwo for reviewing and merging! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Address four reliability warnings reported by SonarCloud:
https://github.com/apache/ratis/runs/119373650680
MessageStreamImpl.streamAsyncbefore creating a stream.IOException.Message.equals(Object)coverage through a parameterized test, avoiding a direct assertion between dissimilar types.assertThrowslambda invokes only one operation under test.Add regression tests for null stream content and arithmetic reply handling.
What is the link to the Apache JIRA
RATIS-2769. Improve null handling and tests flagged by SonarCloud
How was this patch tested?
unit tests & CI