RUM-16086: Catch errors in convertToRumViewAttributes#3497
Merged
Conversation
When deserializing the Parcel inside the Bundle, the methods get/keySet may throw LinkageErrors from Class.forName or BadParcelableException when other errors happen. In those situations, return an empty map for the view attributes.
abrooksv
force-pushed
the
abrooks/RUM-16086
branch
from
June 2, 2026 23:14
49f4733 to
73b9ece
Compare
abrooksv
marked this pull request as ready for review
June 2, 2026 23:30
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3497 +/- ##
===========================================
- Coverage 72.23% 72.21% -0.02%
===========================================
Files 965 965
Lines 35595 35600 +5
Branches 5932 5932
===========================================
- Hits 25712 25708 -4
- Misses 8274 8287 +13
+ Partials 1609 1605 -4
🚀 New features to boost your workflow:
|
0xnm
previously approved these changes
Jun 3, 2026
jonathanmos
previously approved these changes
Jun 3, 2026
ambushwork
previously approved these changes
Jun 3, 2026
Co-authored-by: Jonathan Moskovich <[email protected]>
abrooksv
dismissed stale reviews from ambushwork, jonathanmos, and 0xnm
via
June 3, 2026 13:59
640344c
This comment has been minimized.
This comment has been minimized.
abrooksv
requested review from
ambushwork and
jonathanmos
and removed request for
ambushwork
June 3, 2026 17:02
jonathanmos
approved these changes
Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
When deserializing the Parcel inside the Bundle, the methods get/keySet may throw LinkageErrors from Class.forName or BadParcelableException when other errors happen. In those situations, return an empty map for the view attributes.
API versions before 33 threw from
keySet()due to the eager deserialization, but after that version,getthrows due to switching to lazy deserialization so we must wrap both method calls.Motivation
Code can throw if the Parcel data is invalid:
Additional Notes
For testing, I am using Mockito to inject the behavior due to in our version of roboeletric, the Parcel serialization/deserialization uses an Android specific
java.util.Array.checkOffsetAndCount(int, int, int)leading to NoSuchMethodErrorsI attempted to upgrade it to API version 35 (36 requires JDK 21, and we still run 17 in CI), but that change got too big for this PR so I stopped. LMK if there is any interest in that and I can take another look into finishing the upgrade as another set of PRs
Review checklist (to be filled by reviewers)