diff --git a/kubernetes-kit-starter/src/main/java/com/vaadin/kubernetes/starter/sessiontracker/SessionSerializer.java b/kubernetes-kit-starter/src/main/java/com/vaadin/kubernetes/starter/sessiontracker/SessionSerializer.java index 5faa872..5c2591f 100644 --- a/kubernetes-kit-starter/src/main/java/com/vaadin/kubernetes/starter/sessiontracker/SessionSerializer.java +++ b/kubernetes-kit-starter/src/main/java/com/vaadin/kubernetes/starter/sessiontracker/SessionSerializer.java @@ -279,7 +279,9 @@ private void queueSerialization(String sessionId, sessionId, clusterKey, error); } else { Consumer whenSerialized = sessionInfo -> { - backendConnector.sendSession(sessionInfo); + if (sessionInfo != null) { + backendConnector.sendSession(sessionInfo); + } backendConnector .markSerializationComplete(clusterKey); }; diff --git a/kubernetes-kit-starter/src/test/java/com/vaadin/kubernetes/starter/sessiontracker/SessionSerializerTest.java b/kubernetes-kit-starter/src/test/java/com/vaadin/kubernetes/starter/sessiontracker/SessionSerializerTest.java index a48038d..4b13b95 100644 --- a/kubernetes-kit-starter/src/test/java/com/vaadin/kubernetes/starter/sessiontracker/SessionSerializerTest.java +++ b/kubernetes-kit-starter/src/test/java/com/vaadin/kubernetes/starter/sessiontracker/SessionSerializerTest.java @@ -291,7 +291,8 @@ void serialize_notSerializableException_notFallbackToPessimistic() { verify(connector).markSerializationStarted(clusterSID); await().atMost(500, MILLISECONDS).untilTrue(serializationCompleted); - verify(connector).sendSession(isNull()); + verify(connector, never()).sendSession(any()); + verify(connector).markSerializationComplete(clusterSID); locks.forEach(l -> verify(l, never()).lock()); }