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
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; > } > // ---
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).
I've added clone support to DrawingRecord (needed a few tweaks to your patch to match trunk), and to AbstractEscherHolderRecord. Your testcase now passes
*** Bug 29615 has been marked as a duplicate of this bug. ***
*** Bug 32032 has been marked as a duplicate of this bug. ***
*** Bug 42949 has been marked as a duplicate of this bug. ***