SIGN IN SIGN UP

fix: Trim DSN string before URI parsing (#5113)

* fix: Trim DSN string before URI parsing

Trailing or leading whitespace in the DSN string (commonly introduced
by copy-paste) causes a URISyntaxException that crashes the application
on startup. Trim the DSN before passing it to the URI constructor.

Fixes GH-5087
Co-Authored-By: Claude <noreply@anthropic.com>

* docs: Add changelog entry for DSN trimming fix

Co-Authored-By: Claude <noreply@anthropic.com>

* also trim on SentryOptions.setDsn

* fix: Throw clear error when DSN is empty

Previously an empty or whitespace-only DSN string would fall through
to the URI constructor, producing a confusing error message. Now the
Dsn constructor checks for empty strings after trimming and throws
an IllegalArgumentException with a clear message.

Co-Authored-By: Claude <noreply@anthropic.com>

* Format code

* ci: retrigger checks

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
A
Alexander Dinauer committed
b7fde007e21f716653dd8f2f3ad9afd250899e89
Parent: fc52bb8
Committed by GitHub <noreply@github.com> on 3/2/2026, 3:33:05 PM