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 40508] New: - ObjRecord#clone() is incorrect
Date Thu, 14 Sep 2006 09:05:03 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=40508>.
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=40508

           Summary: ObjRecord#clone() is incorrect
           Product: POI
           Version: 2.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: jajakarta@ytp.ne.jp


I got a exception as follow when copying sheet:

Caused by: java.util.ConcurrentModificationException
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:449)
java.util.AbstractList$Itr.next(AbstractList.java:420)
org.apache.poi.hssf.record.ObjRecord.clone(ObjRecord.java:182)
org.apache.poi.hssf.model.Sheet.cloneSheet(Sheet.java:320)
org.apache.poi.hssf.usermodel.HSSFSheet.cloneSheet(HSSFSheet.java:114)
org.apache.poi.hssf.usermodel.HSSFWorkbook.cloneSheet(HSSFWorkbook.java:337)
 snip

It is caused by a bug of "clone" method in the "ObjRecord" class.
    public Object clone()
    {
        ObjRecord rec = new ObjRecord();
        rec.subrecords = new ArrayList();

        for ( Iterator iterator = subrecords.iterator(); iterator.hasNext(); )
            subrecords.add(( (Record) iterator.next() ).clone()); 

        return rec;
    }

"subrecords.add" must be "rec.subrecords.add" in the "for" block. I got correct
result after modification.

-- 
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