Summary: | DrawingRecord.clone() | ||
---|---|---|---|
Product: | POI | Reporter: | Kevin LaVergne <klavergne> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 2.5-FINAL | ||
Target Milestone: | --- | ||
Hardware: | Other | ||
OS: | other |
Description
Kevin LaVergne
2004-11-02 22:30:42 UTC
We are trying to clone a worksheet that has AutoShapes and Pictures in it. After placing the clone method in the DrawingRecord class, we encountered a different exception as follows: java.util.ConcurrentModificationException at java.util.AbstractList$Itr.checkForComodification (AbstractList.java:462) at java.util.AbstractList$Itr.next(AbstractList.java:433) at org.apache.poi.hssf.record.ObjRecord.clone(ObjRecord.java:182) at org.apache.poi.hssf.model.Sheet.cloneSheet(Sheet.java(Compiled Code)) at org.apache.poi.hssf.usermodel.HSSFSheet.cloneSheet (HSSFSheet.java:114) at org.apache.poi.hssf.usermodel.HSSFWorkbook.cloneSheet (HSSFWorkbook.java:337) After debugging through it, we found out that this error happens in the ObjectRecord clone method(). We modified the clone method as follows: public Object clone() { ObjRecord rec = new ObjRecord(); rec.subrecords = new ArrayList(); List currObj = this.subrecords; for ( Iterator iterator = currObj.iterator(); iterator.hasNext(); ) { rec.subrecords.add(( (Record) iterator.next() ).clone()); } return rec; } After doing this, the worksheet was cloned with the AutoShapes and Pictures |