Bug 58563 - XSSFRichTextString does not implement equals, but HSSFRichTextString does
Summary: XSSFRichTextString does not implement equals, but HSSFRichTextString does
Status: NEEDINFO
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.13-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-29 12:18 UTC by Adrodoc55
Modified: 2016-04-06 02:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrodoc55 2015-10-29 12:18:12 UTC
XSSFRichTextString does not implement equals, but HSSFRichTextString does.
This makes it inconsistent to work with the shared Interface RichTextString.
Comment 1 David North 2015-10-29 12:27:20 UTC
What sort of equality did you have in mind?

* XSSFRichTextString comparable to other XSSFRichTextString (only)
* XSSFRichTextString comparable to HSSFRichTextString

It looks like the HSSF equality is in terms of the string characters themselves, and not the fonts. i.e. it's roughly equivalent to comparing getString() values.

Potentially we could make both sorts comparable on the basis of getString().
Comment 2 Adrodoc55 2015-10-29 12:54:45 UTC
(In reply to David North from comment #1)
> What sort of equality did you have in mind?
> 
> * XSSFRichTextString comparable to other XSSFRichTextString (only)
> * XSSFRichTextString comparable to HSSFRichTextString
> 
> It looks like the HSSF equality is in terms of the string characters
> themselves, and not the fonts. i.e. it's roughly equivalent to comparing
> getString() values.
> 
> Potentially we could make both sorts comparable on the basis of getString().

I had XSSFRichTextString comparable to other XSSFRichTextString (only) in mind.
I am not sure if XSSFRichTextString comparable to HSSFRichTextString would be usefull.

In my concrete case the problem is, that the following assertion works for HSSF but not XSSF:
Cell cell = ...
RichTextString richTextString = ...
cell.setCellValue(richTextString)
assert cell.getRichStringCellValue().equals(richTextString)
Comment 3 Javen O'Neal 2016-04-06 02:05:15 UTC
Shouldn't H/XSSFRichTextString equals method be a rich text compare? If the user wants plain text compare, they can always do H/XSSFRichTextString.getString().equals.