openhab-vscode
openhab-vscode copied to clipboard
Openhab extension fails to initialize for workspace wtih UNC path
Expected Behavior
Opening a vscode workspace with UNC path in the folders
sections and Openhab extension installed should not result in initialize error of the Openhab vscode extension.
Current Behavior
During initialization these two dialog appears:
The output from the extension
openHAB vscode extension has been activated
[Error - 6:29:44 PM] Server initialization failed.
Message: Internal error.
Code: -32603
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: URI has an authority component
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:346)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:632)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
at org.eclipse.xtext.ide.server.concurrent.AbstractRequest.logAndCompleteExceptionally(AbstractRequest.java:73)
at org.eclipse.xtext.ide.server.concurrent.WriteRequest.run(WriteRequest.java:55)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalArgumentException: URI has an authority component
at java.base/sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:53)
at java.base/sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:103)
at java.base/java.nio.file.Path.of(Path.java:203)
at java.base/java.nio.file.Paths.get(Paths.java:97)
at org.openhab.core.model.lsp.internal.MappingUriExtensions.toPathAsInXtext212(MappingUriExtensions.java:184)
at org.openhab.core.model.lsp.internal.MappingUriExtensions.toUri(MappingUriExtensions.java:75)
at org.eclipse.xtext.ide.server.MultiRootWorkspaceConfigFactory.addProjectsForWorkspaceFolder(MultiRootWorkspaceConfigFactory.java:43)
at org.eclipse.xtext.ide.server.MultiRootWorkspaceConfigFactory.getWorkspaceConfig(MultiRootWorkspaceConfigFactory.java:37)
at org.eclipse.xtext.ide.server.WorkspaceManager.createWorkspaceConfig(WorkspaceManager.java:204)
at org.eclipse.xtext.ide.server.WorkspaceManager.refreshWorkspaceConfig(WorkspaceManager.java:211)
at org.eclipse.xtext.ide.server.WorkspaceManager.initialize(WorkspaceManager.java:170)
at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$initialize$0(LanguageServerImpl.java:224)
at org.eclipse.xtext.ide.server.concurrent.WriteRequest.run(WriteRequest.java:50)
... 5 more
Possible Solution
Current workaround is to have only local paths in the workspace.
Example of working workspace configuration
{
"folders": [
{
"path": "."
},
{
"path": "C:\\Users\\"
}
],
"settings": {
"files.eol": "\n",
"files.associations": {
"**/sites-enabled/*.*": "NGINX",
"*.config": "properties",
"*.map": "properties",
"*.old": "openhab"
},
"openhab.useRestApi": false
}
}
Steps to Reproduce (for Bugs)
- Create a workspace containing UNC paths.
- Save as workspace file.
- Re-open the workspace and observe the error.
Example of failing workspace configuration
{
"folders": [
{
"path": "."
},
{
"path": "\\\\docker1.leiflan\\opt_openhab\\2.5.9"
},
{
"path": "\\\\docker1.leiflan\\opt_openhab\\3.x"
}
],
"settings": {
"files.eol": "\n",
"files.associations": {
"**/sites-enabled/*.*": "NGINX",
"*.config": "properties",
"*.map": "properties",
"*.old": "openhab"
},
"openhab.useRestApi": false
}
}
Context
Accidently discovered this while opening a previous workspace after upgrading both my Openhab isntance and the vscode extension.
Your Environment
- Windows 10
- vscode 1.56
- openhab extension v1.0.0
This is a similar topic to #184, #145 and #112. There is (still) no solution available besides the known workaround.