eclipse / lsp4jakarta

Language Server for Jakarta EE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NPE on JsonArray.size() codeAction failure in VSCode after getData() is null

evie-lau opened this issue · comments

[Error - 2:07:32 PM] Request textDocument/codeAction failed.
  Message: Request jakarta/java/codeaction failed with message: java.lang.NullPointerException: Cannot invoke "com.google.gson.JsonArray.size()" because "diagnosticData" is null
  Code: -32603 

To reproduce:

image

Files that seem to call this method and may have this issue:

This is likely caused by the getData() is null problem.

    JsonArray diagnosticData = (JsonArray) diagnostic.getData();

    List<String> annotations = IntStream.range(0, diagnosticData.size())

Related to #416