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

error in JDTLS log: Illegal character in path #2222

Closed
CsCherrYY opened this issue Sep 13, 2022 · 1 comment · Fixed by #2234
Closed

error in JDTLS log: Illegal character in path #2222

CsCherrYY opened this issue Sep 13, 2022 · 1 comment · Fixed by #2234
Assignees

Comments

@CsCherrYY
Copy link
Contributor

The similar error message also can be found in protobuf/android gradle init scripts folder. The project can be imported successfully and there are only the error messages.

It seems this error only appears in VS Code insiders since there is an - in the path string

!MESSAGE Illegal character in path at index 43: file:/C:/Users/chenshi/AppData/Roaming/Code - Insiders/User/globalStorage/redhat.java/1.10.0/config_win/org.eclipse.osgi/53/0/.cp/gradle/init/init.gradle
!STACK 0
java.net.URISyntaxException: Illegal character in path at index 43: file:/C:/Users/chenshi/AppData/Roaming/Code - Insiders/User/globalStorage/redhat.java/1.10.0/config_win/org.eclipse.osgi/53/0/.cp/gradle/init/init.gradle
@CsCherrYY CsCherrYY self-assigned this Sep 13, 2022
@rgrunber
Copy link
Contributor

rgrunber commented Sep 13, 2022

It's the whitespace that isn't supported by java.net.URI. I'm guessing we convert the path to a URI somewhere, so we should probably avoid that.

jshell> new URI("file:/C:/Users/chenshi/AppData/Roaming/Code - Insiders/User/globalStorage/redhat.java/1.10.0/config_win/org.eclipse.osgi/53/0/.cp/gradle/init/init.gradle")
|  Exception java.net.URISyntaxException: Illegal character in path at index 43: file:/C:/Users/chenshi/AppData/Roaming/Code - Insiders/User/globalStorage/redhat.java/1.10.0/config_win/org.eclipse.osgi/53/0/.cp/gradle/init/init.gradle
|        at URI$Parser.fail (URI.java:2974)
|        at URI$Parser.checkChars (URI.java:3145)
|        at URI$Parser.parseHierarchical (URI.java:3227)
|        at URI$Parser.parse (URI.java:3175)
|        at URI.<init> (URI.java:623)
|        at (#4:1)

jshell> new URI("file:/C:/Users/chenshi/AppData/Roaming/Code-Insiders/User/globalStorage/redhat.java/1.10.0/config_win/org.eclipse.osgi/53/0/.cp/gradle/init/init.gradle")
$5 ==> file:/C:/Users/chenshi/AppData/Roaming/Code-Insiders/User/globalStorage/redhat.java/1.10.0/config_win/org.eclipse.osgi/53/0/.cp/gradle/init/init.gradle

My guess is we likely just need to change
https://github.com/eclipse/eclipse.jdt.ls/blob/ed9d3c77ff9a6d0de6caf0813705d4c6a8aedab7/org.eclipse.jdt.ls.core/gradle/android/init.gradle#L233
https://github.com/eclipse/eclipse.jdt.ls/blob/ed9d3c77ff9a6d0de6caf0813705d4c6a8aedab7/org.eclipse.jdt.ls.core/gradle/protobuf/init.gradle#L74

If you're only using java.net.URI because you need relativize(), have a look at java.nio.file.Path, which also has a relativize() method.

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

Successfully merging a pull request may close this issue.

2 participants