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

XSD validator aggressively logs validation errors stacktraces #416

Closed
fbricon opened this issue Jun 5, 2019 · 0 comments · Fixed by #417
Closed

XSD validator aggressively logs validation errors stacktraces #416

fbricon opened this issue Jun 5, 2019 · 0 comments · Fixed by #417
Assignees
Labels
bug Something isn't working
Milestone

Comments

@fbricon
Copy link
Contributor

fbricon commented Jun 5, 2019

When you create a new xsd file and open it, the server logs an exception:

[Error - 11:42:22 AM] Jun. 05, 2019 11:42:22 org.eclipse.lsp4xml.extensions.xsd.participants.diagnostics.XSDValidator doDiagnostics()
Message: Unexpected XMLValidator error
::::-1:-1:-1:Premature end of file.
	at org.eclipse.lsp4xml.services.extensions.diagnostics.AbstractLSPErrorReporter.reportError(AbstractLSPErrorReporter.java:94)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
	at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.parse(Unknown Source)
	at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.parse(Unknown Source)
	at org.apache.xerces.impl.xs.opti.SchemaDOMParser.parse(Unknown Source)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.getSchemaDocument(Unknown Source)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)
	at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
	at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
	at org.eclipse.lsp4xml.extensions.xsd.participants.diagnostics.LSPXMLGrammarPreparser.preparseGrammar(LSPXMLGrammarPreparser.java:53)
	at org.eclipse.lsp4xml.extensions.xsd.participants.diagnostics.XSDValidator.doDiagnostics(XSDValidator.java:89)
	at org.eclipse.lsp4xml.extensions.xsd.participants.diagnostics.XSDDiagnosticsParticipant.doDiagnostics(XSDDiagnosticsParticipant.java:38)
	at org.eclipse.lsp4xml.services.XMLDiagnostics.doExtensionsDiagnostics(XMLDiagnostics.java:83)
	at org.eclipse.lsp4xml.services.XMLDiagnostics.doDiagnostics(XMLDiagnostics.java:51)
	at org.eclipse.lsp4xml.services.XMLLanguageService.doDiagnostics(XMLLanguageService.java:111)
	at org.eclipse.lsp4xml.services.XMLLanguageService.publishDiagnostics(XMLLanguageService.java:120)
	at org.eclipse.lsp4xml.XMLTextDocumentService.doTriggerValidation(XMLTextDocumentService.java:427)
	at org.eclipse.lsp4xml.XMLTextDocumentService.lambda$triggerValidation$19(XMLTextDocumentService.java:419)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:835)

[Trace - 11:42:22 AM] Received notification 'textDocument/publishDiagnostics'.

If you add some invalid content:

<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="property">
</xs:schema>

Then:

Message: Unexpected XMLValidator error
:file:///Users/fbricon/Downloads/sample-resources/incomplete.xsd:file:///Users/fbricon/Downloads/sample-resources/incomplete.xsd:file:///Users/fbricon/Downloads/sample-resources/incomplete.xsd:4:3:116:The element type "xs:complexType" must be terminated by the matching end-tag "</xs:complexType>".
	at org.eclipse.lsp4xml.services.extensions.diagnostics.AbstractLSPErrorReporter.reportError(AbstractLSPErrorReporter.java:94)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.parse(Unknown Source)
	at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.parse(Unknown Source)
	at org.apache.xerces.impl.xs.opti.SchemaDOMParser.parse(Unknown Source)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.getSchemaDocument(Unknown Source)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)
	at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
	at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
	at org.eclipse.lsp4xml.extensions.xsd.participants.diagnostics.LSPXMLGrammarPreparser.preparseGrammar(LSPXMLGrammarPreparser.java:53)
	at org.eclipse.lsp4xml.extensions.xsd.participants.diagnostics.XSDValidator.doDiagnostics(XSDValidator.java:89)
	at org.eclipse.lsp4xml.extensions.xsd.participants.diagnostics.XSDDiagnosticsParticipant.doDiagnostics(XSDDiagnosticsParticipant.java:38)
	at org.eclipse.lsp4xml.services.XMLDiagnostics.doExtensionsDiagnostics(XMLDiagnostics.java:83)
	at org.eclipse.lsp4xml.services.XMLDiagnostics.doDiagnostics(XMLDiagnostics.java:51)
	at org.eclipse.lsp4xml.services.XMLLanguageService.doDiagnostics(XMLLanguageService.java:111)
	at org.eclipse.lsp4xml.services.XMLLanguageService.publishDiagnostics(XMLLanguageService.java:120)
	at org.eclipse.lsp4xml.XMLTextDocumentService.doTriggerValidation(XMLTextDocumentService.java:427)
	at org.eclipse.lsp4xml.XMLTextDocumentService.lambda$triggerValidation$19(XMLTextDocumentService.java:419)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:835)

Those errors should not pollute the logs.

@fbricon fbricon added the bug Something isn't working label Jun 5, 2019
@fbricon fbricon added this to the v0.7.0 milestone Jun 5, 2019
angelozerr added a commit that referenced this issue Jun 5, 2019
Ignore XMLParserException to fix #416

Signed-off-by: azerr <[email protected]>
fbricon pushed a commit that referenced this issue Jun 5, 2019
Ignore XMLParserException to fix #416

Signed-off-by: azerr <[email protected]>
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 a pull request may close this issue.

2 participants