Author: nbelaevski
Date: 2007-10-28 19:56:26 -0400 (Sun, 28 Oct 2007)
New Revision: 3580
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/SequenceDataModel.java
Log:
http://jira.jboss.com/jira/browse/RF-1242
Modified: trunk/framework/api/src/main/java/org/richfaces/model/SequenceDataModel.java
===================================================================
---
trunk/framework/api/src/main/java/org/richfaces/model/SequenceDataModel.java 2007-10-27
01:15:42 UTC (rev 3579)
+++
trunk/framework/api/src/main/java/org/richfaces/model/SequenceDataModel.java 2007-10-28
23:56:26 UTC (rev 3580)
@@ -5,7 +5,9 @@
import java.io.IOException;
import java.util.AbstractList;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -111,6 +113,13 @@
this.wrappedData = data;
if (data instanceof List) {
this.list = (List) data;
+ } else if (data instanceof Collection) {
+ this.list = new ArrayList((Collection) data);
+ //copying all collection content into new collection here should prevent us
+ //from possible issues caused by iteration tricks. e.g.: returning custom iterator
+ //caching current element and comparing indices inside get()
+ //
+ //possible concurrent collection modifications and multithreading will break the
magic
} else if (data instanceof NodeList) {
this.list = new AbstractList() {