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

NPE when document contains an empty tag #613

Closed
mickaelistria opened this issue Mar 5, 2020 · 1 comment
Closed

NPE when document contains an empty tag #613

mickaelistria opened this issue Mar 5, 2020 · 1 comment
Assignees
Labels
bug Something isn't working completion This issue or enhancement is related to completion support
Milestone

Comments

@mickaelistria
Copy link
Contributor

Trying to complete

<project xmlns="http://maven.apache.org/POM/4.0.0"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>

	<groupId>org.test</groupId>
	<artifactId>test</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>pom</packaging>
	
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>3.1.1</version>
				<executions>
					<execution>
						<goals><goal>list</goal></goals>
						<configuration>
							<>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>

in the empty tag inside configuration, I get

SEVERE: While performing ICompletionParticipant#onTagOpen
java.lang.IllegalArgumentException: Property must not be null: label
	at org.eclipse.lsp4j.util.Preconditions.checkNotNull(Preconditions.java:29)
	at org.eclipse.lsp4j.CompletionItem.<init>(CompletionItem.java:136)
	at org.eclipse.lsp4xml.extensions.contentmodel.participants.ContentModelCompletionParticipant.addTagName(ContentModelCompletionParticipant.java:204)
	at org.eclipse.lsp4xml.extensions.contentmodel.participants.ContentModelCompletionParticipant.addTagName(ContentModelCompletionParticipant.java:212)
	at org.eclipse.lsp4xml.extensions.contentmodel.participants.ContentModelCompletionParticipant.addTagName(ContentModelCompletionParticipant.java:212)
	at org.eclipse.lsp4xml.extensions.contentmodel.participants.ContentModelCompletionParticipant.addTagName(ContentModelCompletionParticipant.java:212)
	at org.eclipse.lsp4xml.extensions.contentmodel.participants.ContentModelCompletionParticipant.addTagName(ContentModelCompletionParticipant.java:212)
	at org.eclipse.lsp4xml.extensions.contentmodel.participants.ContentModelCompletionParticipant.addTagName(ContentModelCompletionParticipant.java:212)
	at org.eclipse.lsp4xml.extensions.contentmodel.participants.ContentModelCompletionParticipant.addTagName(ContentModelCompletionParticipant.java:212)
	at org.eclipse.lsp4xml.extensions.contentmodel.participants.ContentModelCompletionParticipant.addTagName(ContentModelCompletionParticipant.java:212)
	at org.eclipse.lsp4xml.extensions.contentmodel.participants.ContentModelCompletionParticipant.fillWithChildrenElementDeclaration(ContentModelCompletionParticipant.java:167)
	at org.eclipse.lsp4xml.extensions.contentmodel.participants.ContentModelCompletionParticipant.fillWithPossibleElementDeclaration(ContentModelCompletionParticipant.java:134)
	at org.eclipse.lsp4xml.extensions.contentmodel.participants.ContentModelCompletionParticipant.onTagOpen(ContentModelCompletionParticipant.java:74)
	at org.eclipse.lsp4xml.services.XMLCompletions.collectOpenTagSuggestions(XMLCompletions.java:493)
	at org.eclipse.lsp4xml.services.XMLCompletions.collectOpenTagSuggestions(XMLCompletions.java:467)
	at org.eclipse.lsp4xml.services.XMLCompletions.collectTagSuggestions(XMLCompletions.java:459)
	at org.eclipse.lsp4xml.services.XMLCompletions.doComplete(XMLCompletions.java:98)
	at org.eclipse.lsp4xml.services.XMLLanguageService.doComplete(XMLLanguageService.java:136)
	at org.eclipse.lsp4xml.XMLTextDocumentService.lambda$completion$1(XMLTextDocumentService.java:175)
	at java.base/java.util.concurrent.CompletableFuture.biApply(CompletableFuture.java:1236)
	at java.base/java.util.concurrent.CompletableFuture$BiApply.tryFire(CompletableFuture.java:1205)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)

As mentioned in #612, the schema proposals here don't make sense. So it's very likely that this issue disappear when #612 is fixed.
However, it may surface in other cases, so a null-check should probably be added.

@angelozerr angelozerr self-assigned this Mar 9, 2020
@angelozerr angelozerr added completion This issue or enhancement is related to completion support bug Something isn't working labels Mar 9, 2020
@angelozerr angelozerr added this to the 0.11.0 milestone Mar 9, 2020
@angelozerr
Copy link
Contributor

Fixed with #620

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completion This issue or enhancement is related to completion support
Projects
None yet
Development

No branches or pull requests

2 participants