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/21 04:44:27 UTC
svn commit: r1291581 -
/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/util/PropertyHashMap.java
Author: gcrawford
Date: Tue Feb 21 03:44:26 2012
New Revision: 1291581
URL: http://svn.apache.org/viewvc?rev=1291581&view=rev
Log:
TRINIDAD-2222 propertyhashmap delta map issues
Modified:
myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/util/PropertyHashMap.java
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/util/PropertyHashMap.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/util/PropertyHashMap.java?rev=1291581&r1=1291580&r2=1291581&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/util/PropertyHashMap.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/util/PropertyHashMap.java Tue Feb 21 03:44:26 2012
@@ -156,6 +156,13 @@ public class PropertyHashMap extends Has
if (_initialStateMarked)
{
if (_deltas == null)
+ {
+ // if deltas is null still call _createDeltaPropertyMap but pass in false in case there
+ // are mutable or partialStateHolder attributes
+ _deltas = _createDeltaPropertyMap(false);
+ }
+
+ if (_deltas == null)
return null;
return StateUtils.saveState(_deltas, context, getUseStateHolder());
@@ -176,28 +183,64 @@ public class PropertyHashMap extends Has
protected PropertyMap createDeltaPropertyMap()
{
- PropertyHashMap map = new PropertyHashMap(2);
- map.setUseStateHolder(getUseStateHolder());
- map.setType(_type);
-
+ return _createDeltaPropertyMap(true);
+ }
+
+ /**
+ *
+ * @param createAlways if createAlways is true then always create the map.
+ * If createAlways is false then only create the map if one of the trackers are empty
+ */
+ private PropertyMap _createDeltaPropertyMap(boolean createAlways)
+ {
PropertyTracker tracker = _getMutableTracker(false);
-
- if (tracker != null)
- {
- for (PropertyKey key: tracker)
- {
- Object val = get(key);
+ PropertyTracker partialTracker = _getPartialStateHolderTracker(false);
+
+ // if createAlways is true then always create the map.
+ // if createAlways is false then only create the map if one of the trackers are empty
+ if (createAlways || tracker != null || partialTracker != null)
+ {
+ PropertyHashMap map = new PropertyHashMap(2);
+ map.setUseStateHolder(getUseStateHolder());
+ map.setType(_type);
- if (val != null)
+ if (tracker != null)
+ {
+ for (PropertyKey key: tracker)
{
- map.put(key, val);
+ Object val = get(key);
+
+ if (val != null)
+ {
+ map.put(key, val);
+ }
}
+
+ _mutableTracker = null;
+ }
+
+
+ if (partialTracker != null)
+ {
+ for (PropertyKey key: partialTracker)
+ {
+ // the key might have been in the mutable tracker, so check if the map already contains the key
+ if(!map.containsKey(key))
+ {
+ Object val = get(key);
+
+ if (val != null)
+ {
+ map.put(key, val);
+ }
+ }
+ }
}
- _mutableTracker = null;
+ return map;
}
- return map;
+ return null;
}
public boolean getUseStateHolder()