-
Notifications
You must be signed in to change notification settings - Fork 6.6k
fix config yaml data type conversion bug #8035
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
Conversation
| Object replaceValue = yaml.load(valueString); | ||
| if (replaceValue instanceof String || replaceValue instanceof Integer || replaceValue instanceof Long || replaceValue instanceof Boolean || replaceValue instanceof ArrayList) { | ||
| return replaceValue; | ||
| } else { | ||
| return valueString; | ||
| } |
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.
Could you add UTs to verify and test what is the case here? And please update the changes.md in the root.
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.
UTs added, changes.md updated.
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 can't see what is the case following into this else, could you explain a little?
Also, I can't see the case relating to the error case you reported. Could you add it there too?
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.
the else case occur when there is a config string like animal: pets, yaml will load it as an object, and return replaceValue isn't class String. I review all the application.yaml config, I found that all the config feild type is one of String Integer Long Boolean ArrayList , so I add the if else check.
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.
But animal: pets isn't supported for the core or extension, isn't it? If so, we should throw exception here rather than returning an unsupported value.
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, make sense.
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.
Have added special password !AI!3B UT for related the error case issue.
|
Could you fix the CI? |
I have deleted UT empty line and passed checkstyle plugin, maven package success locally. |
Notice, test still fails. |
Sry, type error. Now test all success. |
|
Just a confirm, is this case failing in the master branch codes? Have you tested that? |
wu-sheng
left a comment
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.
Checked locally, this UT fails before this fix.
kezhenxu94
left a comment
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
Co-authored-by: yuzhongyu <yuzhongyu@cestc.cn> (cherry picked from commit 149b359)
CHANGESlog.