SVNException (Malformed URL) when username is part of the URL

Description

The SonarScanner raises an exception when a SVN URL with username is used. In our case we use the svn+ssh protocol and the username is uc4@horizont-it.de .
The Exception is:
SVNException: svn: E125002: Malformed URL: ‘svn+ssh://uc4@horizont-it.de@svn.horizont-it.de/lib’

Several svn tools (e.g. Linux, TortoiseSVN) accept this URL.

Workaround

Skip the username in the URL and provide a SVN_SSH environment variable when checking out the sources from SVN. The SVN_SSH environment variable hold the ssh tool along with the -l option for the user:
SVN_SSH=ssh -l uc4@horizont-it.de

Then SonarScanner treats the URL as valid and uses the user name entered in the SCM dialog.

Version

  • SonarScanner CLI Windows 4.6.2.2472
  • SonarQube Developer Edition 8.9.6.50800

Log Snippet

  java.lang.IllegalStateException: Error when executing blame for file src/socket/test_socket_simple.cpp
  	at org.sonar.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:85)
  	at org.sonar.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:58)
  	at org.sonar.scanner.scm.ScmPublisher.publish(ScmPublisher.java:84)
  	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:362)
  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
  	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:150)
  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
  	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
  	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
  	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
  	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
  	at com.sun.proxy.$Proxy0.execute(Unknown Source)
  	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
  	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
  	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
  	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
  	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
  Caused by: org.tmatesoft.svn.core.SVNException: svn: E125002: Malformed URL: 'svn+ssh://uc4@horizont-it.de@svn.horizont-it.de/lib'
  	at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:70)
  	at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:57)
  	at org.tmatesoft.svn.core.SVNURL.<init>(SVNURL.java:296)
  	at org.tmatesoft.svn.core.SVNURL.parseURIEncoded(SVNURL.java:121)
  	at org.tmatesoft.svn.core.internal.wc17.db.SVNWCDb.readInfo(SVNWCDb.java:3534)
  	at org.tmatesoft.svn.core.internal.wc17.SVNStatusEditor17.readInfo(SVNStatusEditor17.java:594)
  	at org.tmatesoft.svn.core.internal.wc17.SVNStatusEditor17.walkStatus(SVNStatusEditor17.java:637)
  	at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgGetStatus.run(SvnNgGetStatus.java:132)
  	at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgGetStatus.run(SvnNgGetStatus.java:27)
  	at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgOperationRunner.run(SvnNgOperationRunner.java:20)
  	at org.tmatesoft.svn.core.internal.wc2.SvnOperationRunner.run(SvnOperationRunner.java:21)
  	at org.tmatesoft.svn.core.wc2.SvnOperationFactory.run(SvnOperationFactory.java:1239)
  	at org.tmatesoft.svn.core.wc2.SvnOperation.run(SvnOperation.java:294)
  	at org.tmatesoft.svn.core.wc.SVNStatusClient.doStatus(SVNStatusClient.java:363)
  	at org.tmatesoft.svn.core.wc.SVNStatusClient.doStatus(SVNStatusClient.java:422)
  	at org.tmatesoft.svn.core.wc.SVNStatusClient.doStatus(SVNStatusClient.java:384)
  	at org.sonar.scm.svn.SvnBlameCommand.checkStatus(SvnBlameCommand.java:99)
  	at org.sonar.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:78)
  	... 22 more