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

Fix completion source crash in Windows OS #408

Merged
merged 1 commit into from
May 31, 2019

Conversation

angelozerr
Copy link
Contributor

Since source was added in completion, completion doesn't work on Windows OS because of use of Path.getPaths to retreive the file name.

For instance: here the error on Window OS

java.nio.file.InvalidPathException: Illegal char <:> at index 4: file:/C:/Users/azerr/.lsp4xml/cache/https/www.w3.org/1999/11/xslt10.xsd
	at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
	at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
	at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
	at java.base/java.nio.file.Path.of(Path.java:147)
	at java.base/java.nio.file.Paths.get(Paths.java:69)

This PR fixes this bug on Wondows OS by avoiding using Paths.getPath to retrieve the file name. I have too cleaned a little the code of generateDocumentation.

Since source was added in completion, completion doesn't work on Windows OS because of use of Path.getPaths to retreive the file name.

For instance: here the error on Window OS

```
java.nio.file.InvalidPathException: Illegal char <:> at index 4: file:/C:/Users/azerr/.lsp4xml/cache/https/www.w3.org/1999/11/xslt10.xsd
	at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
	at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
	at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
	at java.base/java.nio.file.Path.of(Path.java:147)
	at java.base/java.nio.file.Paths.get(Paths.java:69)
```

This PR fixes this bug on Wondows OS by avoiding using Paths.getPath to retrieve the file name.  I have too cleaned a little the code of generateDocumentation.
@angelozerr
Copy link
Contributor Author

@NikolasKomonen @fbricon @xorye please review and merge this PR on master because on Windows OS, completion is broken.

@NikolasKomonen
Copy link
Contributor

NikolasKomonen commented May 31, 2019

@angelozerr works well for me. I can merge it.

Could you explain the problem with Paths.getPath() since I am using it for Path completion in another PR?

@NikolasKomonen NikolasKomonen merged commit f58872a into master May 31, 2019
@angelozerr
Copy link
Contributor Author

Could you explain the problem with Paths.getPath() since I am using it for Path completion in another PR?

See the stack trace, in Windows OS, the schemaURI is called with file:/C:/Users/azerr/.lsp4xml/cache/https/www.w3.org/1999/11/xslt10.xsd.

@angelozerr angelozerr deleted the completion-fix-windows branch May 31, 2019 14:09
@angelozerr angelozerr added this to the v0.7.0 milestone Jun 7, 2019
@angelozerr angelozerr added the bug Something isn't working label Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants