diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/DefaultFlowExecutionRepository.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/DefaultFlowExecutionRepository.java index 752afd12..61d83934 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/DefaultFlowExecutionRepository.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/DefaultFlowExecutionRepository.java @@ -132,17 +132,27 @@ public class DefaultFlowExecutionRepository extends AbstractSnapshottingFlowExec public void updateFlowExecutionSnapshot(FlowExecution execution) { FlowExecutionKey key = execution.getKey(); + if (key == null) { + return; + } Conversation conversation = getConversation(key); getSnapshotGroup(conversation).updateSnapshot(getSnapshotId(key), snapshot(execution)); } public void removeFlowExecutionSnapshot(FlowExecution execution) { FlowExecutionKey key = execution.getKey(); + if (key == null) { + return; + } Conversation conversation = getConversation(key); getSnapshotGroup(conversation).removeSnapshot(getSnapshotId(key)); } public void removeAllFlowExecutionSnapshots(FlowExecution execution) { + FlowExecutionKey key = execution.getKey(); + if (key == null) { + return; + } Conversation conversation = getConversation(execution.getKey()); getSnapshotGroup(conversation).removeAllSnapshots(); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/FlowExecutionSnapshotGroup.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/FlowExecutionSnapshotGroup.java index c52f845b..087cca12 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/FlowExecutionSnapshotGroup.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/FlowExecutionSnapshotGroup.java @@ -30,22 +30,20 @@ public interface FlowExecutionSnapshotGroup { public void addSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot); /** - * Update the snapshot with the given id. + * Update the snapshot with the given id. Does nothing if no snapshot has been added with the id provided. * @param snapshotId the snapshot id * @param snapshot the new snapshot - * @throws SnapshotNotFoundException if there was no previous snapshot to update */ - public void updateSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot) - throws SnapshotNotFoundException; + public void updateSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot); /** - * Remove the snapshot with the given id. + * Remove the snapshot with the given id. Does nothing if no snapshot has been added with the id provided. * @param snapshotId the continuation id */ public void removeSnapshot(Serializable snapshotId); /** - * Remove all snapshots in this group. + * Remove all snapshots in this group. Does nothing if no snapshots have been added to this group. */ public void removeAllSnapshots(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/SimpleFlowExecutionSnapshotGroup.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/SimpleFlowExecutionSnapshotGroup.java index 0fb62506..642c7f74 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/SimpleFlowExecutionSnapshotGroup.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/SimpleFlowExecutionSnapshotGroup.java @@ -87,10 +87,9 @@ class SimpleFlowExecutionSnapshotGroup implements FlowExecutionSnapshotGroup, Se } } - public void updateSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot) - throws SnapshotNotFoundException { + public void updateSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot) { if (!snapshots.containsKey(snapshotId)) { - throw new SnapshotNotFoundException(snapshotId); + return; } snapshots.put(snapshotId, snapshot); }