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

Ignore URIs that do not start with 'file:' #332

Conversation

akashnagesh
Copy link
Contributor

Purpose

Ignore URIs that do not start with file://

Using URIs that have other schemes could lead to IllegalArgumentException

Sample stack-trace:

java.lang.IllegalArgumentException: URI scheme is not "file"
at java.base/java.io.File.(File.java:423)
at org.wso2.lsp4intellij.utils.FileUtils.virtualFileFromURI(FileUtils.java:153)
at org.wso2.lsp4intellij.utils.FileUtils.getAllOpenedEditorsForUri(FileUtils.java:87)
at org.wso2.lsp4intellij.client.languageserver.wrapper.LanguageServerWrapper.connect(LanguageServerWrapper.java:748)

The above exception happens when opening a de-complied source file that have scheme JRT://

LOG.warn(e);
return null;
}
return virtualFileFromURI(uri);
Copy link
Contributor Author

@akashnagesh akashnagesh Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method appears to be a duplicate of virtualFileFromURI(String uri) unless I am missing something.

@nixel2007
Copy link
Contributor

I completely disagree with the purpose of this pr. uri and lsp are schema agnostic, and we must not limit implementation in any way

@akashnagesh
Copy link
Contributor Author

uri and lsp are schema agnostic, and we must not limit implementation in any way

I agree with this, though we seem to specifically check for file:// while sanitizing URI: https://github.com/ballerina-platform/lsp4intellij/blob/3fedd435ae526c568a46f68816fa1a595fd3a921/src/main/java/org/wso2/lsp4intellij/utils/FileUtils.java#L214C37-L214C37

Any suggestions on how we can fix this @nixel2007 ?

@github-actions
Copy link

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@github-actions github-actions bot added the Stale label Aug 16, 2023
@github-actions
Copy link

Closed PR due to inactivity for more than 18 days.

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

Successfully merging this pull request may close these issues.

4 participants