Skip to content

NPE in PropertiesJavaDefinitionHandler.adjustedHighlightRangeForKey #401

Closed

Description

@apupier
[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

Activity

  1. changed the title [-]NPE in ropertiesJavaDefinitionHandler.adjustedHighlightRangeForKey[/-] [+]NPE in PropertiesJavaDefinitionHandler.adjustedHighlightRangeForKey[/+] on Jan 8, 2020
  2. BoykoAlex commented on Jan 8, 2020

    @BoykoAlex
    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.

  3. apupier commented on Jan 8, 2020

    @apupier
    Author

    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

  4. BoykoAlex commented on Jan 8, 2020

    @BoykoAlex
    Contributor

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

  5. kdvolder commented on Jan 9, 2020

    @kdvolder
    Member

    (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.

  6. apupier commented on Jan 10, 2020

    @apupier
    Author

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

  7. added this to the 4.5.1.RELEASE milestone on Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions