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 in CodeActionHandler.getProblemId L.221 #1502

Closed
apupier opened this issue Jul 9, 2020 · 2 comments
Closed

NPE in CodeActionHandler.getProblemId L.221 #1502

apupier opened this issue Jul 9, 2020 · 2 comments

Comments

@apupier
Copy link
Contributor

apupier commented Jul 9, 2020

[Error - 11:06:09 AM] Request textDocument/codeAction failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.lang.NullPointerException
	at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
	at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:618)
	at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:591)
	at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:457)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: java.lang.NullPointerException
	at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getProblemId(CodeActionHandler.java:221)
	at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getProblemLocationCores(CodeActionHandler.java:209)
	at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getCodeActionCommands(CodeActionHandler.java:94)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$14(JDTLanguageServer.java:638)
	at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:616)
	... 6 more

curent content fo the file:

// camel-k: trait=3scale.auto=false trait=3scale.auto=true

import org.apache.camel.builder.RouteBuilder;

public class Simple extends RouteBuilder {
  @Override
  public void configure() throws Exception {

      // Write your routes here, for example:
      from("direct:xx")
  .to("http://quarkus-ml.{{env:NAMESPACE}}.svc.cluster.local/samples")
  //.to("netty-http:http://quarkus-ml.{{env:NAMESPACE}}.svc.cluster.local/samples");

  }
}

it seems to be when there is a diagnostic on th file which is provided by anothe rLanguage Server. In this case, you will need to install https://marketplace.visualstudio.com/items?itemName=redhat.vscode-apache-camel to reproduce with provided file inside VS Code

@apupier
Copy link
Contributor Author

apupier commented Jul 9, 2020

[Trace - 11:09:37 AM] Sending request 'textDocument/codeAction - (128)'.
Params: {
    "textDocument": {
        "uri": "file:///home/apupier/ws/camelk-test/Simple.java"
    },
    "range": {
        "start": {
            "line": 0,
            "character": 23
        },
        "end": {
            "line": 0,
            "character": 23
        }
    },
    "context": {
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 0,
                        "character": 18
                    },
                    "end": {
                        "line": 0,
                        "character": 35
                    }
                },
                "message": "More than one trait defines the same property: 3scale.auto",
                "severity": 1
            }
        ]
    }
}

I think it should check if there is a code or not. Based on specification the code is not mandatory https://microsoft.github.io/language-server-protocol/specification#diagnostic

code?: number | string;

apupier added a commit to apupier/eclipse.jdt.ls that referenced this issue Jul 9, 2020
Signed-off-by: Aurélien Pupier <apupier@redhat.com>
apupier added a commit to apupier/eclipse.jdt.ls that referenced this issue Jul 9, 2020
Signed-off-by: Aurélien Pupier <apupier@redhat.com>
@fbricon fbricon added this to the End July 2020 milestone Jul 9, 2020
fbricon pushed a commit that referenced this issue Jul 15, 2020
Signed-off-by: Aurélien Pupier <apupier@redhat.com>
@fbricon
Copy link
Contributor

fbricon commented Jul 15, 2020

Fixed with #1503

@fbricon fbricon closed this as completed Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants