You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bs...@apache.org on 2010/12/09 19:08:42 UTC

svn commit: r1044055 - /myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/AttributeComponentChange.java

Author: bsullivan
Date: Thu Dec  9 18:08:42 2010
New Revision: 1044055

URL: http://svn.apache.org/viewvc?rev=1044055&view=rev
Log:
Don't replace RowKeySet attribute values

Modified:
    myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/AttributeComponentChange.java

Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/AttributeComponentChange.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/AttributeComponentChange.java?rev=1044055&r1=1044054&r2=1044055&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/AttributeComponentChange.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/AttributeComponentChange.java Thu Dec  9 18:08:42 2010
@@ -28,6 +28,7 @@ import javax.faces.component.UIComponent
 import javax.faces.el.ValueBinding;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+import org.apache.myfaces.trinidad.model.RowKeySet;
 
 
 /**
@@ -109,7 +110,32 @@ public class AttributeComponentChange ex
     }
     else
     {
-      attributeMap.put(_attributeName, _attributeValue);
+      boolean putValue = true;
+      
+      // Specially handle RowKeySet case by replacing the contents of the RowKeySet in-place
+      // rather than replacing the entire object.  This keeps the mutable object instance from
+      // changing
+      if (_attributeValue instanceof RowKeySet)
+      {
+        Object oldValue = attributeMap.get(_attributeName);
+        
+        if (oldValue instanceof RowKeySet)
+        {
+          RowKeySet oldKeySet = (RowKeySet)oldValue;
+          
+          oldKeySet.clear();
+          oldKeySet.addAll((RowKeySet)_attributeValue);
+          
+          // don't replace the RowKeySet
+          putValue = false;
+        }
+      }
+      
+      
+      if (putValue)
+      {
+        attributeMap.put(_attributeName, _attributeValue);
+      }
     }
   }