-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#3216] fix(core): Fix the issue of method checkValue
in the ConfigOption
#3217
Conversation
checkValue
in the ConfigOption
22d537e
to
f8ffd73
Compare
ConfigEntry<List<T>> conf = | ||
new ConfigEntry<>(key, version, doc, alternatives, isPublic, isDeprecated); | ||
conf.setValueConverter((String str) -> strToSeq(str, valueConverter)); | ||
conf.setStringConverter((List<T> val) -> seqToStr(val, stringConverter)); | ||
conf.setStringConverter((List<T> val) -> val == null ? "null" : seqToStr(val, stringConverter)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is a little weird to use "null"
for null config value, can we use null
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
.checkValue( | ||
valueList -> | ||
valueList != null && valueList.stream().allMatch(StringUtils::isNotBlank), | ||
ConfigConstants.NOT_BLANK_ERROR_MSG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the ordering matters? I think it is not just simply changing the ordering to fix the issue. We can misuse it if the implementation is strongly relying on the ordering, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I modify the implement to fix the issue.
- If we call this method before
toSequence
, it will check every element. - If we call this method after
toSequeue
, it will check the list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
…Option (#3217) ### What changes were proposed in this pull request? Fix the issue of method `checkValue` in the ConfigOption. If we use `checkValue` in the wrong position, it won't work. ### Why are the changes needed? Fix: #3216 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? UT. Co-authored-by: Heng Qin <[email protected]>
…ConfigOption (apache#3217) ### What changes were proposed in this pull request? Fix the issue of method `checkValue` in the ConfigOption. If we use `checkValue` in the wrong position, it won't work. ### Why are the changes needed? Fix: apache#3216 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? UT. Co-authored-by: Heng Qin <[email protected]>
What changes were proposed in this pull request?
Fix the issue of method
checkValue
in the ConfigOption. If we usecheckValue
in the wrong position, it won't work.Why are the changes needed?
Fix: #3216
Does this PR introduce any user-facing change?
No.
How was this patch tested?
UT.