poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32032] - DrawingRecord.clone()
Date Fri, 15 Sep 2006 17:17:30 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32032>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32032





------- Additional Comments From eveloz@gmail.com  2006-09-15 17:17 -------
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


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Mime
View raw message