Skip to content

NPE error in textDocument/documentHighlight requests #2952

Closed
eclipse-jdtls/eclipse.jdt.ls
#2492

Description

@kevinh-autoserve1

Request textDocument/documentHighlight failed.
Message: Internal error.
Code: -32603
java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot read the array length because "locations" is null
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Cannot read the array length because "locations" is null
at org.eclipse.jdt.ls.core.internal.handlers.DocumentHighlightHandler.convertToHighlights(DocumentHighlightHandler.java:131)
at org.eclipse.jdt.ls.core.internal.handlers.DocumentHighlightHandler.findHighlights(DocumentHighlightHandler.java:100)
at org.eclipse.jdt.ls.core.internal.handlers.DocumentHighlightHandler.documentHighlight(DocumentHighlightHandler.java:68)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$13(JDTLanguageServer.java:679)
at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:79)
... 7 more

Environment
  • Operating System: Windows and WSL (Ubuntu)
  • JDK version: 17
  • Visual Studio Code version: 1.75.1
  • Java extension version: 1.14.0
Steps To Reproduce
  1. Open Java project
  2. After several uses of language server, it eventually starts crashing and no code completions or symbol lookups function. Requires restart, which eventually just starts crashing again.

[Please attach a sample project reproducing the error]
Please attach logs

Current Result
Expected Result
Additional Informations

Activity

  1. jdneo commented on Feb 20, 2023

    @jdneo
    Collaborator

    We do have a potential NPE at

    at org.eclipse.jdt.ls.core.internal.handlers.DocumentHighlightHandler.convertToHighlights(DocumentHighlightHandler.java:131)
    

    But I have no idea if this could 'crash' the Java language server.

    Meanwhile, there are several complains saying that the extension stops working for some reason these days.

    #2941
    #1765 (comment)

    @kevinh-autoserve1 It would be helpful if a sample project with detailed steps could provide.

  2. changed the title [-]Language support crashes with internal error.[/-] [+]NPE error in textDocument/documentHighlight requests[/+] on Feb 23, 2023
  3. added this to the Mid March 2023 milestone on Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions