You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Shilun Fan (Jira)" <ji...@apache.org> on 2026/10/21 23:23:00 UTC
[jira] [Updated] (RATIS-2769) Improve null handling and tests flagged by SonarCloud
[ https://issues.apache.org/jira/browse/RATIS-2769?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shilun Fan updated RATIS-2769:
------------------------------
Description:
SonarCloud reports four reliability warnings in the current new-code window, causing the reliability quality gate to fail.
Analysis:
https://github.com/apache/ratis/runs/119373650680
Issues
1. MessageStreamImpl.streamAsync dereferences the result of Message.toByteString without checking for null. A null message or
null content causes an implicit NullPointerException.
2. The arithmetic Get command dereferences reply content without checking whether the reply succeeded or contains a value.
Missing content causes a NullPointerException instead of a meaningful error.
3. TestClientProtoUtils directly compares a Message with a String in an assertion, triggering the dissimilar-types comparison rule.
4. TestRaftServerMetadataPersistence places multiple operations that can throw IOException inside one assertThrows lambda, making the
expected exception source unclear to static analysis.
> Improve null handling and tests flagged by SonarCloud
> -----------------------------------------------------
>
> Key: RATIS-2769
> URL: https://issues.apache.org/jira/browse/RATIS-2769
> Project: Ratis
> Issue Type: Bug
> Reporter: Shilun Fan
> Priority: Minor
>
> SonarCloud reports four reliability warnings in the current new-code window, causing the reliability quality gate to fail.
> Analysis:
> https://github.com/apache/ratis/runs/119373650680
> Issues
> 1. MessageStreamImpl.streamAsync dereferences the result of Message.toByteString without checking for null. A null message or
> null content causes an implicit NullPointerException.
> 2. The arithmetic Get command dereferences reply content without checking whether the reply succeeded or contains a value.
> Missing content causes a NullPointerException instead of a meaningful error.
> 3. TestClientProtoUtils directly compares a Message with a String in an assertion, triggering the dissimilar-types comparison rule.
> 4. TestRaftServerMetadataPersistence places multiple operations that can throw IOException inside one assertThrows lambda, making the
> expected exception source unclear to static analysis.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)