You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2003/05/09 17:40:59 UTC
DO NOT REPLY [Bug 19739] -
ContinueRecord not copied by RecordFactory
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19739>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19739
ContinueRecord not copied by RecordFactory
brett.knights@tanner.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Copied Spreadsheet from |ContinueRecord not copied by
|Japan can't be opened. |RecordFactory
------- Additional Comments From brett.knights@tanner.com 2003-05-09 15:40 -------
I stripped down the spreadsheet until I had a very simple one that still
wouldn't copy.
It turns out the problem was in the handling of ContinueRecords. In four cases
in my spreadsheet ContinueRecords followed UnknownRecords. UnknownRecord can't
process ContinueRecords so whatever information was there wasn't being copied
to my new spreadsheet.
I could probably have modified UnknownRecord to suck any following
ContinueRecords in but and recreate them on serialization but the
UnknownRecords weren't anywhere near the record size limit so I have no idea
why the ContinueRecords were there in the first place.
Instead I made the following changes to allow my spreadsheet to copy:
Added a method to org.apache.poi.hssf.record.Record:
/**
* Does this record want to process a Continue record?
*
*/
public boolean isContinueRecordAware()
{
return false;
}
I overrode this method to return true in SSTDeserializer and SSTRecord.
Replaced line 218 of RecordFactory with:
if(last_record.isContinueRecordAware()){
last_record.processContinueRecord(data);
}else{
last_record = record;
records.add(record);
}
Then I made a bunch of changes to ContinueRecord to allow it to serialize like
UnknownRecord. I can diff these if you are interested in applying this as a
patch.
I don't know if this is the best approach to handling ContinueRecords though.
One thought is to make Record ContinueRecord-aware and have it just keep a list
of following ContinueRecords. Classes like SSTDeserializer and SSTRecord would
expand their ContinueRecords as they do now but would also keep their
ContinueRecord copies and would only toss their ContinueRecords(to be
reconstitued if possible) if any of their fields were modified.
Unmodified classes would automatically include their ContinueRecords on
serialization.