File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -749,7 +749,12 @@ Dsn retrieveParsedDsn() throws IllegalArgumentException {
749749 * @param dsn the DSN
750750 */
751751 public void setDsn (final @ Nullable String dsn ) {
752- this .dsn = dsn != null ? dsn .trim () : null ;
752+ if (dsn == null ) {
753+ this .dsn = null ;
754+ } else {
755+ final String trimmedDsn = dsn .trim ();
756+ this .dsn = trimmedDsn .isEmpty () && !dsn .isEmpty () ? dsn : trimmedDsn ;
757+ }
753758 this .parsedDsn .resetValue ();
754759
755760 dsnHash = StringUtils .calculateStringHash (this .dsn , logger );
Original file line number Diff line number Diff line change @@ -340,6 +340,11 @@ class SentryTest {
340340 )
341341 }
342342
343+ @Test
344+ fun `initializes Sentry with whitespace-only dsn, throwing IllegalArgumentException` () {
345+ assertThrows(java.lang.IllegalArgumentException ::class .java) { initForTest { it.dsn = " " } }
346+ }
347+
343348 @Test
344349 fun `captureUserFeedback gets forwarded to client` () {
345350 initForTest { it.dsn = dsn }
You can’t perform that action at this time.
0 commit comments