fix: add missing input validations and correct error messages in ConsumerSetting and ProducerSetting#1
Open
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…umerSetting and ProducerSetting
ConsumerSetting.java:
- Fix double space in error messages ('of consumer' -> 'of consumer')
- Add missing trailing period to error messages for consistency
- Add validation for pollSize (must be > 0)
- Add validation for pollInterval (must be >= 0)
- Add validation for consumerNum (must be > 0)
ProducerSetting.java:
- Fix double space in error messages ('of producer' -> 'of producer')
- Fix off-by-one in nodeId validation (< 16383 -> <= 16383) to match
the documented max value and the check in MsgId.toLong()
- Add validation for nodeId being non-negative (>= 0)
- Add validation for reserveDays (must be >= 0)
Co-Authored-By: kenlin <kenlin8827@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
Fixes incorrect error messages and adds missing input validations in
ConsumerSettingandProducerSetting.Error message fixes (both files):
"of consumer"→"of consumer","of producer"→"of producer")ConsumerSettingmessages for consistency withProducerSettingProducerSetting — nodeId validation fix:
nodeId < 16383tonodeId >= 0 && nodeId <= 16383. The previous check incorrectly rejectednodeId = 16383, despite the Javadoc stating max is 16383, the default value being 16383, andMsgId.toLong()acceptingnodeId == 0x3fff(16383).>= 0) since negative node IDs are invalid.New validations:
ConsumerSetting:pollSize > 0,consumerNum > 0,pollInterval >= 0(all skip validation when null, since defaults are applied afterward)ProducerSetting:reserveDays >= 0Review & Testing Checklist for Human
nodeId <= 16383boundary is correct — confirm inMsgId.toLong()thatnodeId == 16383is indeed valid (nodeId > 0x3fffis the rejection there, so 16383 should pass). This is a behavioral change: previously, explicitly settingnodeId=16383would throw.reserveDayshas no legitimate negative use case — it's a primitiveintdefaulting to 0; the new check rejects negative values.pollSize/consumerNumto 0 in normal config flows — the new validations reject non-positive values when explicitly set but allow null (for default assignment).Notes
afterProperties(), so null values pass through (guarded by== null ||checks) and get their defaults on subsequent lines.Link to Devin session: https://app.devin.ai/sessions/9a2daf0812e049298c54bd4ea18bb1d8
Requested by: @kenlin8827