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 error in textDocument/documentHighlight requests #2952

Closed
kevinh-autoserve1 opened this issue Feb 18, 2023 · 1 comment · Fixed by eclipse-jdtls/eclipse.jdt.ls#2492
Closed

Comments

@kevinh-autoserve1
Copy link

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
@jdneo
Copy link
Collaborator

jdneo commented Feb 20, 2023

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.

@jdneo jdneo changed the title Language support crashes with internal error. NPE error in textDocument/documentHighlight requests Feb 23, 2023
@jdneo jdneo added this to the Mid March 2023 milestone Feb 23, 2023
@jdneo jdneo added the bug label Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants