fix: validate message batch input#10459
Open
gaoxiaolei-s59 wants to merge 1 commit into
Open
Conversation
oss-sentinel-ai
approved these changes
Jun 10, 2026
oss-sentinel-ai
left a comment
There was a problem hiding this comment.
Review: Approved ✅
PR: #10459 — fix: validate message batch input
Type: Bug fix (2 files, +13/-2)
Assessment
Clean implementation that fixes #10458 by replacing assert statements with explicit validation.
Changes
- MessageBatch.java: Replaced
assert messages != nullandassert messages.size() > 0with explicitIllegalArgumentExceptionvalidation - MessageBatchTest.java: Added two test cases covering null and empty message collections
Verdict
✅ Minimal, well-tested fix that ensures consistent behavior regardless of JVM assertion settings.
🤖 Automated review by oss-sentinel-ai
RongtongJin
approved these changes
Jun 10, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10459 +/- ##
=============================================
- Coverage 48.11% 47.99% -0.13%
+ Complexity 13329 13291 -38
=============================================
Files 1377 1377
Lines 100632 100631 -1
Branches 12995 12994 -1
=============================================
- Hits 48422 48293 -129
- Misses 46289 46403 +114
- Partials 5921 5935 +14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 is the purpose of the change
Fixes #10458
MessageBatch.generateFromListused Javaassertstatements to validate null and empty input. That made invalid input behavior depend on assertion settings, producingAssertionErrorwhen assertions are enabled or laterNullPointerExceptionwhen they are disabled.This PR replaces the assertions with explicit
IllegalArgumentExceptionvalidation.Brief changelog
MessageBatch.generateFromListVerifying this change
mvn -pl common -Dtest=MessageBatchTest -Dspotbugs.skip=true testNote
A full
mvn -pl common -Dtest=MessageBatchTest testrun failed before surefire in this local environment because SpotBugs hitjava.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future releaseon the current JDK. The targeted test command above was used to verify the change.