From 51537e8c0692a2e1a143c706f6cd23685d28c3fc Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 22 May 2014 11:39:19 +0100 Subject: [PATCH] Move state saving to getUserEventState() Update JsfView so that state saving no longer occurs during processUserEvent(). This is required to ensure that Mojarra's StateContext.release(...) method is not called too early. Prior to Mojarra 2.1.16 multiple calls to saveView had no side effects, but the fix to JAVASERVERFACES-2609 changed this behavior. In order to retain the fix for SWF-1577 the saveState() method is now called from getUserEventState(). This should ensure that the StateContext$AddRemoveListerner is still removed, even when WebFlow bypasses the usual state saving for certain flow redirects. Issue: SWF-1631 --- .../org/springframework/faces/webflow/JsfView.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfView.java b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfView.java index 7f40eeb1..82d1aa02 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfView.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfView.java @@ -106,10 +106,6 @@ public class JsfView implements View { */ public void processUserEvent() { FacesContext facesContext = FlowFacesContext.getCurrentInstance(); - - // Ensure serialized view state is always updated even if JSF didn't call StateManager.writeState(). SWF-1577 - saveState(); - // Must respect these flags in case user set them during RESTORE_VIEW phase if (!facesContext.getRenderResponse() && !facesContext.getResponseComplete()) { this.facesLifecycle.execute(facesContext); @@ -127,8 +123,11 @@ public class JsfView implements View { } public Serializable getUserEventState() { - // Set the temporary UIViewRoot state so that it will be available across the redirect (see comments in render() - // method) + // Set the temporary UIViewRoot state so that it will be available across the redirect (see comments in render() method) + + // Ensure serialized view state is always updated even if JSF didn't call StateManager.writeState(). SWF-1577 + saveState(); + return new ViewRootHolder(getViewRoot()); }