You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by aw...@apache.org on 2007/01/25 23:42:50 UTC

svn commit: r500057 - in /incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component: StampState.java UIXCollection.java

Author: awiner
Date: Thu Jan 25 15:42:49 2007
New Revision: 500057

URL: http://svn.apache.org/viewvc?view=rev&rev=500057
Log:
ADFFACES-362: IndexOutOfBoundsException in UIXCollection.restoreStampState when transient components are included

Part 3: OK, now we had to fix up some new ClassCastExceptions that resulted from ignoring transient components that hadn't yet been removed

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/StampState.java
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/StampState.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/StampState.java?view=diff&rev=500057&r1=500056&r2=500057
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/StampState.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/StampState.java Thu Jan 25 15:42:49 2007
@@ -167,11 +167,25 @@
       Object childState = state[i];
       // Skip over any saved state that corresponds to transient
       // components
-      if (childState == UIXCollection.Transient.TRUE)
-        continue;
-
-      table.restoreStampState(context, kids.get(childIndex), childState);
-      childIndex++;
+      if (childState != UIXCollection.Transient.TRUE)
+      {
+        table.restoreStampState(context, kids.get(childIndex), childState);
+        childIndex++;
+      }
+      // The component may or may not still be there;  if it
+      // is, then we'd better skip over it
+      else
+      {
+        if (childIndex < kids.size())
+        {
+          UIComponent child = kids.get(childIndex);
+          // If the child isn't transient, then it must be
+          // something that we want to look at on the next
+          // iteration.
+          if (child.isTransient())
+            childIndex++;
+        }
+      }
     }
   }
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java?view=diff&rev=500057&r1=500056&r2=500057
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java Thu Jan 25 15:42:49 2007
@@ -840,6 +840,20 @@
         restoreStampState(context, children.get(childIndex), childState);
         childIndex++;
       }
+      // The component may or may not still be there;  if it
+      // is, then we'd better skip over it
+      else
+      {
+        if (childIndex < children.size())
+        {
+          UIComponent child = children.get(childIndex);
+          // If the child isn't transient, then it must be
+          // something that we want to look at on the next
+          // iteration.
+          if (child.isTransient())
+            childIndex++;
+        }
+      }
     }
   }