ben-gibson/GitLink

IllegalArgumentException when using not fully qualified hostname as remote

holgerbrandl opened this issue · 1 comments

A regression appeared in the plugin around 3 months ago:

When using host name that is not fully qualified (although being resolvable via DNS) the plugin throws an exception when being used (e.g. "open in gitlab").

java.lang.IllegalArgumentException: Invalid host 'git-host'
	at uk.co.ben_gibson.url.Host.<init>(Host.kt:7)
	at uk.co.ben_gibson.url.Host.<init>(Host.kt)
	at uk.co.ben_gibson.url.Host$Companion.invoke(Host.kt:11)
	at uk.co.ben_gibson.url.URL$Companion.fromString(URL.kt:26)
	at uk.co.ben_gibson.git.link.git.RemoteExtensionsKt.getHttpUrl(RemoteExtensions.kt:50)
	at uk.co.ben_gibson.git.link.pipeline.middleware.GenerateUrl.invoke(GenerateUrl.kt:25)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:13)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:38)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.middleware.Timer.invoke(Timer.kt:24)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:13)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:38)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.middleware.ForceHttps.invoke(ForceHttps.kt:14)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:13)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:38)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.middleware.RecordHit.invoke(RecordHit.kt:14)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:13)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:38)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.middleware.SendSupportNotification.invoke(SendSupportNotification.kt:16)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:13)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:38)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.middleware.ResolveContext.invoke(ResolveContext.kt:30)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.accept(Pipeline.kt:31)
	at uk.co.ben_gibson.git.link.GitLinkRunnerKt$processGitLink$$inlined$runBackgroundableTask$1.run(progress.kt:38)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:442)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$5(CoreProgressManager.java:493)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
	at java.base/java.lang.Thread.run(Thread.java:833)

Workaround: By configuring a fully qualified domain as remote for the git working copy, the error can be avoided. In the example above, by changing https://git-host to https://git-host.mycompany.com

I think this should now be resolved in the latest version 4.2.5.