-
Notifications
You must be signed in to change notification settings - Fork 617
Check for missing metadata when constructing ConfigContainer. #2217
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
Coverage ReportAffected SDKs
Test Logs
NotesHTML coverage reports can be produced locally with Head commit (51fcb982) is created by Prow via merging commits: 4468726 f0b0b7f. |
Binary Size ReportAffected SDKs
Test Logs
NotesHead commit (51fcb982) is created by Prow via merging commits: 4468726 f0b0b7f. |
@danasilver: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
@@ -86,11 +86,18 @@ private ConfigContainer( | |||
* <p>The {@code containerJson} must not be modified. | |||
*/ | |||
static ConfigContainer copyOf(JSONObject containerJson) throws JSONException { | |||
// Personalization metadata may not have been written yet. | |||
JSONObject personalizationMetadataJSON = | |||
containerJson.optJSONObject(PERSONALIZATION_METADATA_KEY); |
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.
Thinking out loud: getJSONObject
throws if the given key isn't found, which would result in the new ConfigContainer
not being created, as noted in #2186 (comment). Metadata depends on integrations with RC and may not be defined, ie it's not necessarily an error case, and may be a common case (eg for a project that never uses metadata). Using optJSONObject
instead facilitates checking for null and assigning a default value rather than throwing.
No description provided.