jtulach commented on code in PR #7579:
URL: https://github.com/apache/netbeans/pull/7579#discussion_r1677745661


##########
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java:
##########
@@ -1032,7 +1032,10 @@ public CompletableFuture<List<Either<Command, 
CodeAction>>> codeAction(CodeActio
                             continue;
                         }
                     }
-                    Optional<Diagnostic> diag = diagnostics.stream().filter(d 
-> entry.getKey().equals(d.getCode().getLeft())).findFirst();
+                    Optional<Diagnostic> diag = diagnostics.stream().filter(d 
-> {
+                        String code = d.getCode() != null ? 
d.getCode().getLeft() : null;

Review Comment:
   Unrelated to the core of this PR, but discovered at the same time. According 
to the [LSP 
Spec](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnostic)
 `code` field is **optional**. Need to check for `null`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to