vscode-java
vscode-java copied to clipboard
Space in path of java.settings.url causes URISyntaxException
Illegal character in path at index xx: /Users/t/OneDrive - company/code/java_global.prefs
java.net.URISyntaxException: Illegal character in path at index xx: /Users/t/OneDrive - company/code/java_global.prefs
at java.base/java.net.URI$Parser.fail(Unknown Source)
at java.base/java.net.URI$Parser.checkChars(Unknown Source)
at java.base/java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.base/java.net.URI$Parser.parse(Unknown Source)
at java.base/java.net.URI.<init>(Unknown Source)
at org.eclipse.jdt.ls.core.internal.managers.StandardProjectsManager.getURIs(StandardProjectsManager.java:533)
at org.eclipse.jdt.ls.core.internal.managers.StandardProjectsManager.fileChanged(StandardProjectsManager.java:201)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceEventsHandler.didChangeWatchedFiles(WorkspaceEventsHandler.java:115)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.didChangeWatchedFiles(JDTLanguageServer.java:518)
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.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:152)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
at org.eclipse.jdt.ls.core.internal.ParentProcessWatcher.lambda$0(ParentProcessWatcher.java:130)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Environment
- Operating System: macOS
- JDK version:
- Visual Studio Code version: Version: 1.70.2
- Java extension version: v1.9.0
Steps To Reproduce
In settings, set java.settings.url to a path with space in it.
Current Result
The exception above
Expected Result
no exception
@matter-it-does
The error is thrown from here due to /Users/t/OneDrive - company/code/java_global.prefs cannot be parsed to a URI.
Then it will be dealt as a file path. In your case, are the settings in the java_global.prefs file take effect?
@matter-it-does Then it will be dealt as a file path. In your case, are the settings in the
java_global.prefsfile take effect?
@jdneo
Oh I just noticed, they take effect, but the exception is a bit confusing and cluttering
Would @snjeza 's PR from https://github.com/redhat-developer/vscode-java/pull/2451 help with this ?
Seems not. https://github.com/redhat-developer/vscode-java/pull/2451 is to check invalid url value. While in this case, user's url is a valid value.
The exception is thrown because the server will first try to parse a windows file path string to a URL. After failure, the server fallbacks to treat it as a file path. So it's still working finally.