vaadin / copilot

0 stars 0 forks source link

[BUG] Copilot.handleMessage is throwing a NPE when accessing the commands field (List<CopilotCommand>) #21

Closed SebastianKuehnau closed 1 month ago

SebastianKuehnau commented 1 month ago

Please provide as many details as possible; this will help us deliver a fix as soon as possible. Thank you!

Description of the Bug

When starting the copilot in a Vaadin 24.4. application I'm getting a NPE with the following error message:

java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because "this.commands" is null
    at com.vaadin.copilot.Copilot.handleMessage(Copilot.java:124) ~[copilot-24.4.0.jar:na]
    at com.vaadin.base.devserver.DebugWindowConnection.onMessage(DebugWindowConnection.java:321) ~[vaadin-dev-server-24.4.0.jar:na]
    at com.vaadin.flow.server.communication.PushHandler.handleDebugWindowMessage(PushHandler.java:650) ~[flow-server-24.4.0.jar:24.4.0]

The List of List commands never got initiated. Copilot.java linenr. 40.

Expected Behavior

Vaadin Application should start without errors. The List of CoPilotCommands needs to be instantiated.

Minimal Reproducible Example

Start a Vaadin 24.4.1. App with CoPilot.

Versions

SebastianKuehnau commented 1 month ago

It seems the handleMessage method is called before the setupCommands (initializing the commands field) method is invoked.

Artur- commented 1 month ago

How do you reproduce this?

Start a Vaadin 24.4.1. App with CoPilot

works without this exception

SebastianKuehnau commented 1 month ago

I created a Vaadin 24.4. project on start.vaadin.com, build everything with Java 21 and try to let run with the result of getting the error message above.

SebastianKuehnau commented 1 month ago

The com.vaadin:copilot dependency in my local repository was broken. Deleting it in my local rep and rebuild the project, make the app working.