Bug 31795 - [PATCH] Sheet not cloneable
Summary: [PATCH] Sheet not cloneable
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.5-FINAL
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
: 29615 32032 42949 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-20 08:28 UTC by Horst Fiedler
Modified: 2008-01-09 03:06 UTC (History)
4 users (show)



Attachments
Test case (3.21 KB, application/zip)
2005-05-02 14:26 UTC, Robert Lowe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Horst Fiedler 2004-10-20 08:28:56 UTC
java.lang.RuntimeException: The class org.apache.poi.hssf.record.DrawingRecord
needs to define a clone method
        at org.apache.poi.hssf.record.Record.clone(Record.java:194)
        at org.apache.poi.hssf.model.Sheet.cloneSheet(Sheet.java:320)
        at org.apache.poi.hssf.usermodel.HSSFSheet.cloneSheet(HSSFSheet.java:114)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.cloneSheet(HSSFWorkbook.java:337)
        at com.tifff.Spread2.processADD(Spread2.java:424)
        at com.tifff.activator.Spread$SpreadGenerator.run(Spread.java:166)
        at java.lang.Thread.run(Thread.java:534)
20.10.2004 10:15:39 com.tifff.Spread2 processADD
Comment 1 Horst Fiedler 2004-10-20 14:09:20 UTC
Add something like that to overcome: 
diff $R DrawingRecord.java
111a112,123
>     // --- H.F. 20.10.2004
>     public Object clone() {
>         DrawingRecord rec = new DrawingRecord();
>       byte[] nRecordData = recordData;
>       if (recordData != null) {
>         nRecordData = new byte[recordData.length];
>         System.arraycopy(recordData, 0, nRecordData, 0, recordData.length);
>       }
>         rec.setData(nRecordData);
>         return rec;
>     }
>     // ---
Comment 2 Robert Lowe 2005-05-02 14:26:34 UTC
Created attachment 14902 [details]
Test case

The attached test case succeeds on POI 2.0 (poi-2.0-final-20040126.jar), but
produces an error on 2.5.1 (poi-2.5.1-final-20040804.jar) and 2.5
(poi-2.5-final-20040302.jar).
Comment 3 Nick Burch 2008-01-09 03:00:02 UTC
I've added clone support to DrawingRecord (needed a few tweaks to your patch to
match trunk), and to AbstractEscherHolderRecord. Your testcase now passes
Comment 4 Nick Burch 2008-01-09 03:05:57 UTC
*** Bug 29615 has been marked as a duplicate of this bug. ***
Comment 5 Nick Burch 2008-01-09 03:06:10 UTC
*** Bug 32032 has been marked as a duplicate of this bug. ***
Comment 6 Nick Burch 2008-01-09 03:06:38 UTC
*** Bug 42949 has been marked as a duplicate of this bug. ***