-
-
Notifications
You must be signed in to change notification settings - Fork 45
Null-check when logging integrity analytics event #3382
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
… event with a null (or "null") responseCode.
app/src/org/commcare/google/services/analytics/FirebaseAnalyticsUtil.java
Outdated
Show resolved
Hide resolved
📝 WalkthroughWalkthroughThe change adds a null-check in the Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
app/src/org/commcare/google/services/analytics/FirebaseAnalyticsUtil.java (1)
434-436: Null-check logic is correct, but consider whether to proceed with analytics submission.The null-check and logging implementation correctly handles both
nulland the string"null". The short-circuit evaluation prevents NPE. However, the method continues to send the analytics event with the null/invalidresponseCode(line 441), which may pollute analytics data and make it harder to distinguish legitimate integrity issues from data quality problems.Consider whether the method should return early after logging instead of proceeding:
if(responseCode == null || responseCode.equals("null")) { Logger.exception("Integrity Check", new Exception("Null response code in integrity check: " + responseCode)); + return; }If you intend to track these null cases in analytics for visibility, the current approach works, but you may want to verify that downstream analytics consumers can handle or filter these null values appropriately.
Minor: The exception message could be simplified since concatenating
responseCodeis redundant when you already know it's null or "null":-Logger.exception("Integrity Check", new Exception("Null response code in integrity check: " + responseCode)); +Logger.exception("Integrity Check", new Exception("Null or invalid response code in integrity check"));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/src/org/commcare/google/services/analytics/FirebaseAnalyticsUtil.java(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/src/org/commcare/google/services/analytics/FirebaseAnalyticsUtil.java (1)
app/src/org/commcare/android/integrity/IntegrityTokenViewModel.kt (1)
exception(128-128)
conroy-ricketts
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
https://dimagi.atlassian.net/browse/CCCT-1808
Product Description
No user-facing change
Technical Summary
Logging a non-fatal exception when trying to send integrity analytics event with a null (or "null") responseCode.
Safety story
Simple change to log a non-fatal exception, not user-facing.
Automated test coverage
None