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

ArrayIndexOutOfBoundsException with xml.format.grammarAwareFormatting set to true #1651

Open
enxio opened this issue Jun 28, 2024 · 2 comments

Comments

@enxio
Copy link

enxio commented Jun 28, 2024

Hi,

I am getting the exception below when trying to format with xml.format.grammarAwareFormatting being set to true. With the setting being false, no exception occurs. Afterwards, formatting (sometimes) behaves erratic, I was not able to further track this down. It might be related.

Please let me know how I can help to track this further down.

Thanks for any clarification.

[Error - 14:35:54] Jun 28, 2024 02:35:54 org.eclipse.lemminx.extensions.dtd.contentmodel.CMDTDDocument internalEntityDecl()
Message: Error while extracting information for the internal entity 'wcirc'
java.lang.ArrayIndexOutOfBoundsException: Index 2048 out of bounds for length 2048
	at org.eclipse.lemminx.extensions.dtd.contentmodel.CMDTDDocument$ScannedDTDEntityDecl.getEntityNameStartColumnNumber(CMDTDDocument.java:210)
	at org.eclipse.lemminx.extensions.dtd.contentmodel.CMDTDDocument$ScannedDTDEntityDecl.createNameParameter(CMDTDDocument.java:167)
	at org.eclipse.lemminx.extensions.dtd.contentmodel.CMDTDDocument$ScannedDTDEntityDecl.<init>(CMDTDDocument.java:130)
	at org.eclipse.lemminx.extensions.dtd.contentmodel.CMDTDDocument$ScannedDTDEntityDecl.<init>(CMDTDDocument.java:116)
	at org.eclipse.lemminx.extensions.dtd.contentmodel.CMDTDDocument.internalEntityDecl(CMDTDDocument.java:321)
	at org.apache.xerces.impl.XMLDTDScannerImpl.scanEntityDecl(Unknown Source)
	at org.apache.xerces.impl.XMLDTDScannerImpl.scanDecls(Unknown Source)
	at org.apache.xerces.impl.XMLDTDScannerImpl.scanDTDExternalSubset(Unknown Source)
	at org.apache.xerces.impl.dtd.XMLDTDLoader.loadGrammar(Unknown Source)
	at org.eclipse.lemminx.extensions.dtd.contentmodel.CMDTDDocument.loadGrammar(CMDTDDocument.java:394)
	at org.eclipse.lemminx.extensions.dtd.contentmodel.CMDTDContentModelProvider.createCMDocument(CMDTDContentModelProvider.java:81)
	at org.eclipse.lemminx.extensions.contentmodel.model.ContentModelManager.findCMDocument(ContentModelManager.java:333)
	at org.eclipse.lemminx.extensions.contentmodel.model.ContentModelManager.findCMDocument(ContentModelManager.java:153)
	at org.eclipse.lemminx.extensions.contentmodel.model.ContentModelManager.findCMDocument(ContentModelManager.java:103)
	at org.eclipse.lemminx.extensions.contentmodel.model.ContentModelManager.findCMDocument(ContentModelManager.java:86)
	at org.eclipse.lemminx.extensions.contentmodel.participants.ContentModelFormatterParticipant.getFormatElementCategory(ContentModelFormatterParticipant.java:69)
	at org.eclipse.lemminx.services.format.XMLFormatterDocument.getFormatElementCategory(XMLFormatterDocument.java:599)
	at org.eclipse.lemminx.services.format.DOMElementFormatter.getFormatElementCategory(DOMElementFormatter.java:480)
	at org.eclipse.lemminx.services.format.DOMElementFormatter.formatElement(DOMElementFormatter.java:45)
	at org.eclipse.lemminx.services.format.XMLFormatterDocument.format(XMLFormatterDocument.java:341)
	at org.eclipse.lemminx.services.format.XMLFormatterDocument.formatChildren(XMLFormatterDocument.java:372)
	at org.eclipse.lemminx.services.format.XMLFormatterDocument.format(XMLFormatterDocument.java:330)
	at org.eclipse.lemminx.services.format.XMLFormatterDocument.formatSiblings(XMLFormatterDocument.java:313)
	at org.eclipse.lemminx.services.format.XMLFormatterDocument.format(XMLFormatterDocument.java:170)
	at org.eclipse.lemminx.services.format.XMLFormatterDocument.format(XMLFormatterDocument.java:137)
	at org.eclipse.lemminx.services.XMLFormatter.format(XMLFormatter.java:61)
	at org.eclipse.lemminx.services.XMLLanguageService.format(XMLLanguageService.java:135)
	at org.eclipse.lemminx.XMLTextDocumentService.lambda$formatting$10(XMLTextDocumentService.java:345)
	at org.eclipse.lemminx.commons.ModelTextDocuments.lambda$computeModelAsync$0(ModelTextDocuments.java:118)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
@angelozerr
Copy link
Contributor

Please share your xml file that you are tring to format.

@enxio
Copy link
Author

enxio commented Jun 28, 2024

Unfortunately, I can't. It's full of proprietary information.

I see whether I can track this further down and come up with a demonstrator.

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

No branches or pull requests

2 participants