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

ShortcutRegistration throws NPE #19769

Open
simasch opened this issue Aug 9, 2024 · 2 comments
Open

ShortcutRegistration throws NPE #19769

simasch opened this issue Aug 9, 2024 · 2 comments

Comments

@simasch
Copy link

simasch commented Aug 9, 2024

Description of the bug

I see the exception below in the logs.
I can't reproduce it but I think this should be caught by the framework because there is no code of mine involved.

java.lang.NullPointerException: Cannot invoke "com.vaadin.flow.component.Component.isVisible()" because "component" is null
	at com.vaadin.flow.component.ShortcutRegistration.ancestorsOrSelfAreVisible(ShortcutRegistration.java:648) ~[flow-server-24.4.4.jar:24.4.4]
	at com.vaadin.flow.component.ShortcutRegistration.fireShortcutEvent(ShortcutRegistration.java:641) ~[flow-server-24.4.4.jar:24.4.4]
	at com.vaadin.flow.component.ShortcutRegistration.lambda$updateHandlerListenerRegistration$89e5c563$1(ShortcutRegistration.java:601) ~[flow-server-24.4.4.jar:24.4.4]
	at com.vaadin.flow.component.ComponentEventBus.fireEventForListener(ComponentEventBus.java:239) ~[flow-server-24.4.4.jar:24.4.4]
	at com.vaadin.flow.component.ComponentEventBus.handleDomEvent(ComponentEventBus.java:488) ~[flow-server-24.4.4.jar:24.4.4]
	at com.vaadin.flow.component.ComponentEventBus.lambda$addDomTrigger$dd1b7957$1(ComponentEventBus.java:298) ~[flow-server-24.4.4.jar:24.4.4]
	at com.vaadin.flow.internal.nodefeature.ElementListenerMap.lambda$fireEvent$2(ElementListenerMap.java:473) ~[flow-server-24.4.4.jar:24.4.4]
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) ~[na:na]
	at com.vaadin.flow.internal.nodefeature.ElementListenerMap.fireEvent(ElementListenerMap.java:473) ~[flow-server-24.4.4.jar:24.4.4]
	at com.vaadin.flow.server.communication.rpc.EventRpcHandler.handleNode(EventRpcHandler.java:62) ~[flow-server-24.4.4.jar:24.4.4]
	at com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler.handle(AbstractRpcInvocationHandler.java:73) ~[flow-server-24.4.4.jar:24.4.4]
	at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocationData(ServerRpcHandler.java:475) ~[flow-server-24.4.4.jar:24.4.4]
	at com.vaadin.flow.server.communication.ServerRpcHandler.lambda$handleInvocations$5(ServerRpcHandler.java:456) ~[flow-server-24.4.4.jar:24.4.4]
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) ~[na:na]
	at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:456) ~[flow-server-24.4.4.jar:24.4.4]
	at com.vaadin.flow.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:324) ~[flow-server-24.4.4.jar:24.4.4]
	at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:114) ~[flow-server-24.4.4.jar:24.4.4]
	at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) ~[flow-server-24.4.4.jar:24.4.4]

Expected behavior

No NPE should be thrown.

Minimal reproducible example

Unfortunately I cannot reproduce it.

Versions

  • Vaadin / Flow version: 24.4.8
  • Java version: 21
@Legioth
Copy link
Member

Legioth commented Aug 9, 2024

Speculation on how to reproduce: this might be a timing issue with a component becoming invisible concurrently with a user triggering a keyboard event related to the same component.

@simasch
Copy link
Author

simasch commented Aug 9, 2024

But how can the lifecycle owner become null?

image

@mshabarov mshabarov moved this from 🆕 Needs triage to 🔎 Investigation in Vaadin Flow bugs & maintenance (Vaadin 10+) Sep 4, 2024
@mshabarov mshabarov moved this from 🔎 Investigation to 🔖 High Priority (P1) in Vaadin Flow bugs & maintenance (Vaadin 10+) Sep 4, 2024
@mshabarov mshabarov moved this from 🔖 High Priority (P1) to 🔖 Normal Priority (P2) in Vaadin Flow bugs & maintenance (Vaadin 10+) Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🔖 Normal Priority (P2)
Development

No branches or pull requests

4 participants