schemaLocation with trailing `\` causes telemetry to error
Given:
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd\">
</beans>
(note the trailing \ in the file location for the second schema referenced)
The following Exception gets logged:
Message: Error while processing didOpen for the participant 'org.eclipse.lemminx.extensions.contentmodel.participants.DocumentTelemetryParticipant'.
org.eclipse.lemminx.uriresolver.InvalidURIException: The 'http://www.springframework.org/schema/util/spring-util.xsd\' URI cannot be parsed: Illegal character in path at index 58: http://www.springframework.org/schema/util/spring-util.xsd\
at org.eclipse.lemminx.uriresolver.CacheResourcesManager.getResourceCachePath(CacheResourcesManager.java:306)
at org.eclipse.lemminx.extensions.contentmodel.model.ContentModelManager.fillReferencedGrammarInfo(ContentModelManager.java:268)
at org.eclipse.lemminx.extensions.contentmodel.model.ContentModelManager.getReferencedGrammarInfos(ContentModelManager.java:233)
at org.eclipse.lemminx.telemetry.DocumentTelemetryInfo.collectDocumentTelemetryInfo(DocumentTelemetryInfo.java:42)
at org.eclipse.lemminx.telemetry.TelemetryManager.onDidOpen(TelemetryManager.java:65)
at org.eclipse.lemminx.extensions.contentmodel.participants.DocumentTelemetryParticipant.didOpen(DocumentTelemetryParticipant.java:32)
at org.eclipse.lemminx.XMLTextDocumentService.lambda$validate$31(XMLTextDocumentService.java:640)
at java.util.ArrayList.forEach(ArrayList.java:1511)
at org.eclipse.lemminx.XMLTextDocumentService.lambda$validate$32(XMLTextDocumentService.java:638)
at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
at com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:704)
at com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:202)
I wanna work on this, all I gotta do is to remove the trailing \ right? and Can you please tell me where can i find this code?
Thanks @haseeb-xd! I'll try to give a better description of the error.
The main idea is that we try to convert every second entry of the xsi:schemaLocation attribute to a URI and download that URI if it's a remote file (http/https). However, if the entry is not a proper URI, an Exception will be thrown. In ContentModelManager.java, on line 249, it would be nice to check if the URI contains no URI syntax errors before we try to download it.
This should prevent the Exception I mentioned from being logged. It's a good idea to prevent the Exception from being logged, because it's not abnormal for an XML document to have syntax errors in it while it's being edited.
@haseeb-xd okay, I added more details. Feel free to ask any questions you have!
Hello @datho7561, I would like to work on this issue
Thanks! Feel free to ask any questions you have, and to ping me on the PR for review once it's ready.
Hii @datho7561 Can you please tell me how to install this project locally I was using IntelliJ IDEA and I got many errors while building the project. And how to test that I have made the right changes in the code.
@Satyamkumarnavneet Take a look at https://github.com/eclipse/lemminx/blob/main/CONTRIBUTING.md if you haven't yet.
The main idea is that this repository is a Maven project. I haven't used Intellij much, but you should be able to import the root folder as a Maven project. If you give me more information on what errors you are seeing, I might be able to help a bit more.
Also, make sure that you can build the project on command line with ./mvnw clean verify (Linux/macOS) or mvnw.cmd clean verify (Windows). This will compile the project into a .jar, and it will run the tests.
The way that I test the changes is by using lemminx in VS Code through the vscode-xml project. Here is more information on how to set up vscode-xml and test lemminx using it. You can also test it through other LSP-enabled editors like neovim or emacs, but the process is best documented for VS Code.
I will follow up with some steps for adding unit tests for the change...

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project org.eclipse.lemminx: Compilation failure: Compilation failure:
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/GenerateDocTypeCodeActionResolver.java:[36,56] cannot find symbol
[ERROR] symbol: class AbstractGenerateGrammarAndAssociationResolveCodeActionParticipant
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/NoGrammarConstraintsCodeAction.java:[67,51] cannot find symbol
[ERROR] symbol: variable GenerateXSINoNamespaceSchemaCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.nogrammarconstraints.NoGrammarConstraintsCodeAction
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/NoGrammarConstraintsCodeAction.java:[68,37] cannot find symbol
[ERROR] symbol: class GenerateXSINoNamespaceSchemaCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.nogrammarconstraints.NoGrammarConstraintsCodeAction
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/NoGrammarConstraintsCodeAction.java:[69,51] cannot find symbol
[ERROR] symbol: variable GenerateXMLModelWithXSDCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.nogrammarconstraints.NoGrammarConstraintsCodeAction
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/NoGrammarConstraintsCodeAction.java:[70,37] cannot find symbol
[ERROR] symbol: class GenerateXMLModelWithXSDCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.nogrammarconstraints.NoGrammarConstraintsCodeAction
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/NoGrammarConstraintsCodeAction.java:[72,33] incompatible types: org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.nogrammarconstraints.GenerateDocTypeCodeActionResolver cannot be converted to org.eclipse.lemminx.services.extensions.codeaction.ICodeActionResolvesParticipant
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/NoGrammarConstraintsCodeAction.java:[73,51] cannot find symbol
[ERROR] symbol: variable GenerateXMLModelWithDTDCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.nogrammarconstraints.NoGrammarConstraintsCodeAction
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/NoGrammarConstraintsCodeAction.java:[74,37] cannot find symbol
[ERROR] symbol: class GenerateXMLModelWithDTDCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.nogrammarconstraints.NoGrammarConstraintsCodeAction
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/NoGrammarConstraintsCodeAction.java:[75,51] cannot find symbol
[ERROR] symbol: variable GenerateRelaxNGSchemaCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.nogrammarconstraints.NoGrammarConstraintsCodeAction
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/NoGrammarConstraintsCodeAction.java:[76,37] cannot find symbol
[ERROR] symbol: class GenerateRelaxNGSchemaCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.nogrammarconstraints.NoGrammarConstraintsCodeAction
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/NoGrammarConstraintsCodeAction.java:[108,41] cannot find symbol
[ERROR] symbol: variable GenerateXMLModelWithXSDCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.nogrammarconstraints.NoGrammarConstraintsCodeAction
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/NoGrammarConstraintsCodeAction.java:[129,41] cannot find symbol
[ERROR] symbol: variable GenerateXMLModelWithDTDCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.nogrammarconstraints.NoGrammarConstraintsCodeAction
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/NoGrammarConstraintsCodeAction.java:[177,41] cannot find symbol
[ERROR] symbol: variable GenerateXSINoNamespaceSchemaCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.nogrammarconstraints.NoGrammarConstraintsCodeAction
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/NoGrammarConstraintsCodeAction.java:[222,41] cannot find symbol
[ERROR] symbol: variable GenerateRelaxNGSchemaCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.nogrammarconstraints.NoGrammarConstraintsCodeAction
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/GenerateDocTypeCodeActionResolver.java:[40,9] method does not override or implement a method from a supertype
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/nogrammarconstraints/GenerateDocTypeCodeActionResolver.java:[46,9] method does not override or implement a method from a supertype
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/missingelement/required_elements_missing_expectedCodeAction.java:[66,51] cannot find symbol
[ERROR] symbol: variable required_elements_missing_expectedCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.missingelement.required_elements_missing_expectedCodeAction
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/missingelement/required_elements_missing_expectedCodeAction.java:[67,37] cannot find symbol
[ERROR] symbol: class required_elements_missing_expectedCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.missingelement.required_elements_missing_expectedCodeAction
[ERROR] /C:/Users/satyam kumar navneet/Documents/Satyam document/GSOC/The-Eclipse-Foundation/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/missingelement/required_elements_missing_expectedCodeAction.java:[119,41] cannot find symbol
[ERROR] symbol: variable required_elements_missing_expectedCodeActionResolver
[ERROR] location: class org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.missingelement.required_elements_missing_expectedCodeAction
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn
Now I am getting this error, please have a look
Now I am getting this error, please have a look
Sorry, I really don't know what's happening. Do the files it listed exist (eg. is there a filelemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/missingelement/required_elements_missing_expectedCodeActionResolver.java?)
In missingelement there are only four java files:
1. MissingElementDataConstants
2. required_element_missingCodeAction
3. required_element_missingCodeActionResolver
4. required_elements_missing_expectedCodeAction
Hmm. Another thing to check is does git status report that you've changed anything outside of the files you meant to? Maybe Intellij tried to fix things for you and accidentally made them worse?
You have one file missing from https://github.com/eclipse/lemminx/tree/main/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/codeactions/missingelement.
Try git reset --hard origin main
Yes, that file is missing when I used git status it shows lots of files are deleted...
