Return NORMAL for a null property map in TopicMessageType.parseFromMessageProperty#10553
Conversation
parseFromMessageProperty threw a NullPointerException for a null message property map. Guard against null and return TopicMessageType.NORMAL.
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Adds a null guard to TopicMessageType.parseFromMessageProperty() to return NORMAL when the property map is null, preventing NullPointerException.
Findings
- [Info]
TopicMessageType.java:50-52— Correct defensive fix. The null check is placed at the right position (before anymessageProperty.get()call). - [Info]
TopicMessageTypeTest.java:140-144— Test covers the null case explicitly.
Verdict
Simple, correct defensive fix. LGTM.
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Adds a null check at the top of TopicMessageType.parseFromMessageProperty() to return NORMAL when the property map is null, preventing a potential NullPointerException.
Findings
- [Info]
TopicMessageType.java:50-52— Clean defensive null guard. ReturningNORMALas the default is consistent with the existing fallback behavior when no special properties are found. - [Info]
TopicMessageTypeTest.java:141-144— Simple and direct test for the null case.
Suggestions
- Consider whether callers that pass
nullrepresent a bug in the caller. If so, it might be worth logging a warning atDEBUGorWARNlevel to help diagnose the root cause, rather than silently treating null as empty. This is optional — the null guard itself is a good defensive measure regardless.
Verdict
Clean, minimal fix. LGTM.
Automated review by github-manager-bot
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10553 +/- ##
=============================================
- Coverage 48.27% 48.16% -0.11%
+ Complexity 13435 13405 -30
=============================================
Files 1377 1378 +1
Lines 100844 100824 -20
Branches 13036 13037 +1
=============================================
- Hits 48678 48564 -114
- Misses 46217 46290 +73
- Partials 5949 5970 +21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
TopicMessageType.parseFromMessagePropertydereferences the message-property map without a null check, throwing aNullPointerExceptionwhen the map is null. Guard against null and returnTopicMessageType.NORMAL.Added a test for the null case.
Verifying this change
The added
TopicMessageTypeTest#testParseFromMessageProperty_Nullfails on the currentdevelopand passes with this change:Before the fix (on
develop):After the fix:
AI assistance disclosure
This contribution was produced with the help of an AI pipeline. The pipeline processed a large amount of source code to surface suspected bugs, reproduced a subset of them with failing unit tests and generated candidate fixes, and prepared pull requests from the ones that held up. Each PR was then reviewed and verified by a human before being opened: the fix and test were checked by hand and the test was confirmed to fail before the change and pass after.