diff --git a/jbpm/jbpm-usertask/src/main/java/org/kie/kogito/usertask/impl/InMemoryUserTaskInstances.java b/jbpm/jbpm-usertask/src/main/java/org/kie/kogito/usertask/impl/InMemoryUserTaskInstances.java index 55da7c4c0e2..def2088da39 100644 --- a/jbpm/jbpm-usertask/src/main/java/org/kie/kogito/usertask/impl/InMemoryUserTaskInstances.java +++ b/jbpm/jbpm-usertask/src/main/java/org/kie/kogito/usertask/impl/InMemoryUserTaskInstances.java @@ -70,7 +70,7 @@ public void setDisconnectUserTaskInstance(Function findById(String userTaskInstanceId) { try { if (!userTaskInstances.containsKey(userTaskInstanceId)) { - return null; + return Optional.empty(); } UserTaskInstance userTaskInstance = mapper.readValue(userTaskInstances.get(userTaskInstanceId), DefaultUserTaskInstance.class); return Optional.ofNullable(reconnectUserTaskInstance.apply(userTaskInstance));