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 in PropertiesJavaDefinitionHandler.adjustedHighlightRangeForKey #401

Closed
apupier opened this issue Jan 8, 2020 · 7 comments
Closed
Milestone

Comments

@apupier
Copy link

apupier commented Jan 8, 2020

[Error - 2:50:31 PM] Request textDocument/definition failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.lang.NullPointerException
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:346)
	at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:704)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
	at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
	at reactor.core.publisher.MonoToCompletableFuture.onError(MonoToCompletableFuture.java:68)
	at reactor.core.publisher.FluxSubscribeOnCallable$CallableSubscribeOnSubscription.run(FluxSubscribeOnCallable.java:228)
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
	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:834)
Caused by: java.lang.NullPointerException
	at org.springframework.ide.vscode.boot.app.PropertiesJavaDefinitionHandler.adjustedHighlightRangeForKey(PropertiesJavaDefinitionHandler.java:112)
	at org.springframework.ide.vscode.boot.app.PropertiesJavaDefinitionHandler.getDefinitions(PropertiesJavaDefinitionHandler.java:87)
	at org.springframework.ide.vscode.boot.app.PropertiesJavaDefinitionHandler.handle(PropertiesJavaDefinitionHandler.java:70)
	at org.springframework.ide.vscode.languageserver.starter.LanguageServerAutoConf.lambda$null$2(LanguageServerAutoConf.java:96)
	at org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService.lambda$definition$9(SimpleTextDocumentService.java:364)
	at reactor.core.publisher.MonoCallable.call(MonoCallable.java:91)
	at reactor.core.publisher.FluxSubscribeOnCallable$CallableSubscribeOnSubscription.run(FluxSubscribeOnCallable.java:225)
	... 7 more

I was using an application.properties file, outside of a project with content:
camel.component.activemq.errorHandlerLoggingLevel=DEBUG
It is triggered when calling completion with Ctrl+space but I cannot find a way to reliably reproduce

@apupier apupier changed the title NPE in ropertiesJavaDefinitionHandler.adjustedHighlightRangeForKey NPE in PropertiesJavaDefinitionHandler.adjustedHighlightRangeForKey Jan 8, 2020
@BoykoAlex
Copy link
Contributor

AFAIU the setup is the following:
Project A located in the workspace has camel.component.activemq.errorHandlerLoggingLevel=DEBUG property defined.
Project B depends on project A has application.properties file that is being edited.
Content assists is invoked with content camel.component.activemq.errorHandlerLoggingLevel=DEBUG? Where is the cursor at the moment of CA invocation?

The NPE is in "jump to definition" code. This code is invoked when Ctrl/Cmd key is pressed and mouse is hovered over content in Boot properties file. I doubt it is related to CA but rather to hovering over content in Boot properties file with Ctrl/Cmd pressed... Are you getting this NPE while hovering on something in particular?
We should definitely guard against the NPE while hovering on something that isn't a boot property but if it is a valid boot property and the NPE is occurring we'd need to dig deeper into this.

@apupier
Copy link
Author

apupier commented Jan 8, 2020

Content assists is invoked with content camel.component.activemq.errorHandlerLoggingLevel=DEBUG?

this is the full application.properties file content

Where is the cursor at the moment of CA invocation?

I was able to have the stack when the cursor was at different places in "activemq.errorHandlerLoggingLevel" but calling on the same place doesn't trigger the stack every time.

Are you getting this NPE while hovering on something in particular?

and now realizing what you mean. I have the stack without calling the content assist.
I "just" need to Ctrl+hover on any parts of the file content to have the stack.

I can reproduce with a single file in the workspace of the VS Code instance and with another content

Screenshot from 2020-01-08 15-34-28

@BoykoAlex
Copy link
Contributor

Thanks! Should be a trivial fix... Will try to get it in by the end of today.

@BoykoAlex
Copy link
Contributor

Should be fixed with f460ad2
Please try updating from the nightly update site:

@martinlippert
Copy link
Member

@apupier The Eclipse p2 repos for the CI builds are:

(not the one that Alex mentioned above, I think).

In case you are looking for the CI build of the VSCode extension, you can find that one here:

(but it looks like the latest CI build isn't there yet, so need to take a look at what is wrong there)

@kdvolder
Copy link
Member

kdvolder commented Jan 9, 2020

(but it looks like the latest CI build isn't there yet, so need to take a look at what is wrong there)

From what I can tell the builds seem to fine now. Seems to have been a disk space issue on the build machines earlier.

@apupier
Copy link
Author

apupier commented Jan 10, 2020

tested with nightly vscode-spring-boot-1.15.0-202001091659.vsix and the issue is fixed.
Thanks!

@apupier apupier closed this as completed Jan 10, 2020
@martinlippert martinlippert added this to the 4.5.1.RELEASE milestone Jan 10, 2020
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

4 participants