Skip to content
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

refactor: use java.net.URI for parsing URLs in UrlUtils #4210

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

lcian
Copy link
Member

@lcian lcian commented Feb 25, 2025

📜 Description

This changes the internal logic used for parsing URLs in UrlUtils from regex based to using java.net.URI.
This will allow the SDK to handle the cases described in #2690 and getsentry/team-sdks#39.
java.net.URI is known to still not be fully compliant with RFCs 3986 and 3987 (https://cr.openjdk.org/%7Edfuchs/writeups/updating-uri/) but this is still an improvement with respect to the cases described in the issues linked above, and could also ensure correct handling for other corner cases that we are not aware of.
We still use java.net.URL but just for validating that an URI is a valid URL.

This could affect grouping for existing issues that use (parts of) an URL as the message when the URL falls in the affected corner cases.

💡 Motivation and Context

Closes #2690

💚 How did you test it?

Added some tests and changed existing ones

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 344.18 ms 425.04 ms 80.86 ms
Size 1.58 MiB 2.21 MiB 641.66 KiB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Correctly filter URL with an email address in it
1 participant