Bug 49649 - The class org.apache.poi.hssf.record.XXX needs to define a clone method
Summary: The class org.apache.poi.hssf.record.XXX needs to define a clone method
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.7-dev
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-26 12:13 UTC by Antti Koskimäki
Modified: 2010-07-28 11:53 UTC (History)
0 users



Attachments
Test-code and quick-and-dirty patch for clone exception problem (32.55 KB, application/x-zip-compressed)
2010-07-26 12:13 UTC, Antti Koskimäki
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koskimäki 2010-07-26 12:13:12 UTC
Created attachment 25803 [details]
Test-code and quick-and-dirty patch for clone exception problem

Got exceptions from wb.cloneSheet() method: 

java.lang.RuntimeException: The class org.apache.poi.hssf.record.HeaderFooterRecord needs to define a clone method

java.lang.RuntimeException: The class org.apache.poi.hssf.record.FeatHdrRecord needs to define a clone method

java.lang.RuntimeException: The class org.apache.poi.hssf.record.UserSViewBegin needs to define a clone method

Exceptions are from different excel-files, but problem is common; I used to be able to clone some sheets and with current version poi-3.7-beta2 at SVN r965267 not anymore.

Got some old POI versions hanging around, and all above cases do clone fine with poi-3.6-beta1 at SVN r816626. I think problem was introduced in releases 835183, 894018 and 892468, when corresponding classes were introduced.

Quick-and-dirty solution was to implement clone with cloneViaReserialise. Seems to work, at least.

Attached test-files plus test-code to re-produce problem, as well as patch for quick-and-dirty solution.
Comment 1 Yegor Kozlov 2010-07-28 11:53:26 UTC
Applied in r980102

Yegor