Skip to content

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

Merged
merged 1 commit into from
Dec 2, 2020

Conversation

danasilver
Copy link
Contributor

No description provided.

@googlebot googlebot added the cla: yes Override cla label Dec 1, 2020
@google-oss-bot
Copy link
Contributor

Coverage Report

Affected SDKs

  • firebase-config

    SDK overall coverage changed from 88.47% (4468726) to 88.50% (51fcb982) by +0.03%.

    Filename Base (4468726) Head (51fcb982) Diff
    ConfigContainer.java 91.80% 92.19% +0.38%

Test Logs

Notes

HTML coverage reports can be produced locally with ./gradlew <product>:checkCoverage.
Report files are located at <product-build-dir>/reports/jacoco/.

Head commit (51fcb982) is created by Prow via merging commits: 4468726 f0b0b7f.

@google-oss-bot
Copy link
Contributor

Binary Size Report

Affected SDKs

  • firebase-config

    Type Base (4468726) Head (51fcb982) Diff
    aar 70.8 kB 70.8 kB +68 B (+0.1%)
    apk (aggressive) 90.7 kB 90.7 kB +12 B (+0.0%)
    apk (release) 716 kB 716 kB -16 B (-0.0%)

Test Logs

Notes

Head commit (51fcb982) is created by Prow via merging commits: 4468726 f0b0b7f.

@google-oss-bot
Copy link
Contributor

@danasilver: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
smoke-tests f0b0b7f link /test smoke-tests

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);
Copy link

@erikeldridge erikeldridge Dec 1, 2020

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.

@danasilver danasilver merged commit 141830d into master Dec 2, 2020
@danasilver danasilver deleted the rc-opt-personalization-fix branch December 2, 2020 00:44
@firebase firebase locked and limited conversation to collaborators Jan 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Override cla size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants