ConcurrentModificationException
遍历数组时候的exception ConcurrentModificationException at java.util.ArrayList$ListIterator.next(ArrayList.java:at 573) at com.rits.cloning.FastClonerArrayList.clone()
I think this is due to some other thread modifying the cloned array list. Cloner doesn't synchronize access (wouldn't be a very good thing to do).
@lyx0224 Could be also due to bug in your code, for example, following code fails, because sublist doesn't allow structural modification to the backing list.
List<String> a = new LinkedList<String>();
a.add("1");
a.add("2");
a.add("3");
List<String> b = a.subList(0, 1);
b.add("3");
b.remove(0);
a.remove("3");
List<String> clone = cloner.deepClone(b); // JDK8 throws java.util.ConcurrentModificationException
clone.size(); // with JDK 10 clone gets created, but querying it's size fails with java.util.ConcurrentModificationException
I believe that this might be fixed. In later Java versions we needed to specially handle AbstractList$Sublist. Can you check with version 1.10.0?
Yesterday I had the same Exception because I was cloning a Java Bean with a Logger property in it. (I forgot the static keyword) but crashed all the JVM. I would expect that if it was only a concurrentException it should fail the deepClone method
(lib version 1.9.0)