The Branch Android SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
Issue: The parseReferringURL function in the ReferringUrlUtility class throws an UnsupportedOperationException with the message "This isn't a hierarchical URI". This error occurs when attempting to access uri.queryParameterNames for a non-hierarchical URI (e.g., app:home), which lacks the structured path and query parameters of a hierarchical URI (e.g., app://home).
Solution: The fix involves adding a check to determine if the URI is hierarchical using uri.isHierarchical() before iterating over uri.queryParameterNames in the for loop. If the URI is found to be non-hierarchical, the function now logs a debug message and bypasses the query parameter parsing logic, preventing the UnsupportedOperationException. There is also a new unit test to properly test this case.
Testing Instructions
Open a test app with a hierarchical and non-hierarchical URI to see the proper behavior and logging.
Risk Assessment [LOW]
[x] I, the PR creator, have tested — integration, unit, or otherwise — this code.
Reviewer Checklist (To be checked off by the reviewer only)
Description
Issue: The
parseReferringURL
function in the ReferringUrlUtility class throws an UnsupportedOperationException with the message "This isn't a hierarchical URI". This error occurs when attempting to accessuri.queryParameterNames
for a non-hierarchical URI (e.g., app:home), which lacks the structured path and query parameters of a hierarchical URI (e.g., app://home).Solution: The fix involves adding a check to determine if the URI is hierarchical using
uri.isHierarchical()
before iterating overuri.queryParameterNames
in the for loop. If the URI is found to be non-hierarchical, the function now logs a debug message and bypasses the query parameter parsing logic, preventing the UnsupportedOperationException. There is also a new unit test to properly test this case.Testing Instructions
Open a test app with a hierarchical and non-hierarchical URI to see the proper behavior and logging.
Risk Assessment [
LOW
]Reviewer Checklist (To be checked off by the reviewer only)
cc @BranchMetrics/saas-sdk-devs for visibility.