You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gc...@apache.org on 2012/02/17 02:27:28 UTC
svn commit: r1245282 -
/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadComponentHandler.java
Author: gcrawford
Date: Fri Feb 17 01:27:28 2012
New Revision: 1245282
URL: http://svn.apache.org/viewvc?rev=1245282&view=rev
Log:
TRINIDAD-2217 when using partial state saving markInitialState called many times
Modified:
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadComponentHandler.java
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadComponentHandler.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadComponentHandler.java?rev=1245282&r1=1245281&r2=1245282&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadComponentHandler.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadComponentHandler.java Fri Feb 17 01:27:28 2012
@@ -30,6 +30,8 @@ import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseId;
+
import org.apache.myfaces.trinidad.component.UIXComponent;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -92,8 +94,19 @@ public class TrinidadComponentHandler ex
{
if (component.getId() == null)
component.setId(context.generateUniqueId(UIViewRoot.UNIQUE_ID_PREFIX));
-
- ((UIXComponent) component).markInitialState();
+
+ PhaseId phase = context.getFacesContext().getCurrentPhaseId();
+
+ // In jsf2 markInitialState will be called by the framework during restore view,
+ // and in fact the framework should always be the one
+ // calling markInitialState, but it doesn't always do that in render response, see
+ // http://java.net/jira/browse/JAVASERVERFACES-2285
+ // Also don't call markInitialState unless initialStateMarked returns false, otherwise
+ // any deltas previously saved may get blown away.
+ if (PhaseId.RENDER_RESPONSE.equals(phase) && !component.initialStateMarked())
+ {
+ component.markInitialState();
+ }
}
}