You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by jw...@apache.org on 2011/07/27 22:59:15 UTC

svn commit: r1151624 - /myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java

Author: jwaldman
Date: Wed Jul 27 20:59:14 2011
New Revision: 1151624

URL: http://svn.apache.org/viewvc?rev=1151624&view=rev
Log:
TRINIDAD-2112 RowKeySetAttributeChange calls into model when component is not in context
2.0.0.1-branch
thanks to Prakash Udupa for the patch 

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

Modified: myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java?rev=1151624&r1=1151623&r2=1151624&view=diff
==============================================================================
--- myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java (original)
+++ myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java Wed Jul 27 20:59:14 2011
@@ -75,17 +75,6 @@ public final class RowKeySetAttributeCha
 
   private void _updateRowKeySetInPlace(UIComponent component, String attrName, RowKeySet newValue)
   {
-    // Check whether the remembered RowKeySet object is in a valid state (iterable).
-    try 
-    {
-      newValue.iterator().hasNext();
-    }
-    catch (Exception e) 
-    {
-      _LOG.warning("FAILED_ROWKEYSETATTRIBUTECHANGE", e.getClass());
-      return;
-    }
-
     ValueExpression oldExpression = component.getValueExpression(attrName);
     
     // due to bug in how the trinidad table and tree handle their RowKeySets, always use
@@ -109,7 +98,7 @@ public final class RowKeySetAttributeCha
     {
       _expression = expression;
       _attributeName = attributeName;
-      _newKeySet = newKeySet;
+      _newKeySet  = newKeySet;
     }
     
     public void invokeContextCallback(FacesContext context,
@@ -138,11 +127,19 @@ public final class RowKeySetAttributeCha
         {
           RowKeySet oldKeySet = (RowKeySet)oldValue;
           
-          oldKeySet.clear();
-          
-          if (_newKeySet != null)
+          try
+          {
+            oldKeySet.clear();
+            
+            if (_newKeySet != null)
+            {
+              oldKeySet.addAll(_newKeySet);
+            }
+          }
+          catch (Exception e)
           {
-            oldKeySet.addAll(_newKeySet);
+            _LOG.warning("FAILED_ROWKEYSETATTRIBUTECHANGE", e);
+            return;
           }
         }
         else
@@ -160,6 +157,5 @@ public final class RowKeySetAttributeCha
 
   private static final long serialVersionUID = 1L;
   static private final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(RowKeySetAttributeChange.class);
-  
   private final String _clientId;
 }