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 2007/03/21 16:03:44 UTC

DO NOT REPLY [Bug 40460] - java.lang.ClassCastException: org.apache.poi.hssf.record.LabelRecord

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=40460>.
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=40460





------- Additional Comments From gwghome@comcast.net  2007-03-21 08:03 -------
Created an attachment (id=19767)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=19767&action=view)
Proposed fix to kludge for LabelRecord data type

The current kludge for converting out-dated LabelRecords to LabelSSTRecords
generated ClassCastExceptions when I tried to read a spreadsheet created by MS
Works, supposedly saved in Excel 97/2000 format.

The problem appears to be that the conversion method :
    sheet.convertLabelRecords(workbook);
is called too late in the sequence.  By the time it is called, the records have
already been processed, and it is during that processing that the exception
fails.	The specific issue is that LabelRecord does not implement Comparator
interface, but there is a secondary problem that the LabelRecords are inserted
into a second data structure (ValueRecordsAggregate	 cells) during that
process and those entries are not converted to LabelSSTRecords during the
conversion.

I believe the better way to handle this is to do the conversion in
usermodel.HSSFWorkbook.java prior to creating the Sheet objects.  This appears
to work for me.  The code changes in the attached file are located between line
numbers 170 and 210.  They do the conversion on the records structure and
comment out the call to convertLabelRecords in Sheet.  That method might be
eliminated if this patch is applied.

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