Author: nbelaevski
Date: 2010-04-28 18:53:10 -0400 (Wed, 28 Apr 2010)
New Revision: 16834
Modified:
branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
Log:
https://jira.jboss.org/jira/browse/RFPL-526
Modified:
branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
===================================================================
---
branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2010-04-28
18:23:52 UTC (rev 16833)
+++
branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2010-04-28
22:53:10 UTC (rev 16834)
@@ -1487,6 +1487,39 @@
private SerializableDataModel model;
}
+ private Map<String, Map<String, SavedState>> createChildStateCopy(
+ Map<String, Map<String, SavedState>> originalChildState) {
+ Map<String, Map<String, SavedState>> copiedChildState = null;
+
+ if (originalChildState != null) {
+ int originalMapSize = originalChildState.size();
+
+ // formula copied from HashMap implementation code
+ int copiedMapCapacity = Math.max(
+ (int) (originalMapSize / 0.75) + 1, 16);
+
+ copiedChildState = new HashMap<String, Map<String, SavedState>>(
+ copiedMapCapacity);
+
+ for (Entry<String, Map<String, SavedState>> entry : originalChildState
+ .entrySet()) {
+ String entryKey = entry.getKey();
+ Map<String, SavedState> entryValue = entry.getValue();
+
+ Map<String, SavedState> copiedEntryValue = null;
+
+ if (entryValue != null) {
+ copiedEntryValue = new HashMap<String, SavedState>(
+ entryValue);
+ }
+
+ copiedChildState.put(entryKey, copiedEntryValue);
+ }
+ }
+
+ return copiedChildState;
+ }
+
public void restoreState(FacesContext faces, Object object) {
DataState state = (DataState) object;
super.restoreState(faces, state.superState);
@@ -1494,7 +1527,7 @@
this._statesMap = new HashMap<String, DataComponentState>();
this._rowKeyVar = state.rowKeyVar;
this._stateVar = state.stateVar;
- this.childState = state.childStates;
+ this.childState = createChildStateCopy(state.childStates);
if (null != state.rowKeyConverter) {
this._rowKeyConverter = (Converter) restoreAttachedState(faces,
state.rowKeyConverter);