Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Space in path of java.settings.url causes URISyntaxException #2637

Open
matter-it-does opened this issue Aug 19, 2022 · 4 comments
Open

Space in path of java.settings.url causes URISyntaxException #2637

matter-it-does opened this issue Aug 19, 2022 · 4 comments
Assignees

Comments

@matter-it-does
Copy link

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

@jdneo jdneo self-assigned this Aug 19, 2022
@jdneo jdneo added the bug label Aug 19, 2022
@jdneo
Copy link
Collaborator

jdneo commented Aug 19, 2022

@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
Copy link
Author

@matter-it-does
Then it will be dealt as a file path. In your case, are the settings in the java_global.prefs file take effect?

@jdneo

Oh I just noticed, they take effect, but the exception is a bit confusing and cluttering

@rgrunber
Copy link
Member

Would @snjeza 's PR from #2451 help with this ?

@jdneo
Copy link
Collaborator

jdneo commented Aug 23, 2022

Seems not. #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants