Prevent serialization errors when persisting/restoring session data.
SECTION: Modified Files
----------------------------
M src/com/sun/faces/application/StateManagerImpl.java
- see comments
SECTION: Diffs
----------------------------
Index: src/com/sun/faces/application/StateManagerImpl.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/application/StateManagerImpl.java,v
retrieving revision 1.50
diff -u -r1.50 StateManagerImpl.java
--- src/com/sun/faces/application/StateManagerImpl.java 6 Jun 2006 00:30:15 -0000 1.50
+++ src/com/sun/faces/application/StateManagerImpl.java 16 Jun 2006 21:12:48 -0000
@@ -165,7 +165,13 @@
return null;
}
- viewRoot = restoreTree(((Object[]) stateArray[0]));
+ // We need to clone the tree, otherwise we run the risk
+ // of being left in a state where the restored
+ // UIComponent instances are in the session instead
+ // of the TreeNode instances. This is a problem
+ // for servers that persist session data since
+ // UIComponent instances are not serializable.
+ viewRoot = restoreTree(((Object[]) stateArray[0]).clone());
viewRoot.processRestoreState(context, stateArray[1]);
if (LOGGER.isLoggable(Level.FINE)) {