diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationContainer.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationContainer.java index fd66cc4f..c400f10b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationContainer.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationContainer.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import org.springframework.core.JdkVersion; import org.springframework.webflow.conversation.Conversation; import org.springframework.webflow.conversation.ConversationId; import org.springframework.webflow.conversation.ConversationParameters; @@ -98,7 +99,11 @@ class ConversationContainer implements Serializable { } private ConversationId nextId() { - return new SimpleConversationId(Integer.valueOf(++conversationIdSequence)); + if (JdkVersion.isAtLeastJava15()) { + return new SimpleConversationId(Integer.valueOf(++conversationIdSequence)); + } else { + return new SimpleConversationId(new Integer(++conversationIdSequence)); + } } /** diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewState.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewState.java index 48e1a5b6..18444e3e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewState.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewState.java @@ -226,7 +226,6 @@ public class ViewState extends TransitionableState { public void exit(RequestControlContext context) { super.exit(context); - destroyVariables(context); if (history == History.PRESERVE) { context.updateCurrentFlowExecutionSnapshot(); } else if (history == History.DISCARD) { @@ -234,6 +233,7 @@ public class ViewState extends TransitionableState { } else if (history == History.INVALIDATE) { context.removeAllFlowExecutionSnapshots(); } + destroyVariables(context); } // internal helpers diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/AbstractFlowExecutionRepository.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/AbstractFlowExecutionRepository.java index 96ed7f5e..58ac0749 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/AbstractFlowExecutionRepository.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/AbstractFlowExecutionRepository.java @@ -19,6 +19,7 @@ import java.io.Serializable; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.core.JdkVersion; import org.springframework.util.Assert; import org.springframework.util.StringUtils; import org.springframework.webflow.conversation.Conversation; @@ -157,7 +158,7 @@ public abstract class AbstractFlowExecutionRepository implements FlowExecutionRe if (alwaysGenerateNewNextKey) { CompositeFlowExecutionKey key = (CompositeFlowExecutionKey) execution.getKey(); Integer continuationId = (Integer) key.getContinuationId(); - Integer nextId = Integer.valueOf(continuationId.intValue() + 1); + Integer nextId = nextContinuationId(continuationId); return new CompositeFlowExecutionKey(key.getConversationId(), nextId); } else { return execution.getKey(); @@ -232,6 +233,14 @@ public abstract class AbstractFlowExecutionRepository implements FlowExecutionRe return conversation; } + private Integer nextContinuationId(Integer continuationId) { + if (JdkVersion.isAtLeastJava15()) { + return Integer.valueOf(continuationId.intValue() + 1); + } else { + return new Integer(continuationId.intValue() + 1); + } + } + private Serializable parseContinuationId(String encodedId, String encodedKey) { try { return Integer.valueOf(encodedId);