SimpleMailMessage's handling of to/cc/bcc arrays is inconsistent [SPR-16671] #21212
Labels
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Juergen Hoeller opened SPR-16671 and commented
SimpleMailMessage
has some pretty old inconsistent handling of itsto
,cc
andbcc
arrays: copying them in the copy constructor but passing the original (mutable) arrays on incopyTo(MailMessage)
, and wrongly checking the array elements fornull
in thehashCode
implementation. Let's finally streamline those in 5.0.5 and 4.3.15 towards consistent array copying and consistent use ofObjectUtils.nullSafeHashCode
.Last but not least,
SimpleMailMessage.hashCode()
should not includetext
which is the most expensive to calculate and very unlikely to change if all other fields are the same anyway.Affects: 4.3.14, 5.0.4
Referenced from: commits 4cf1795, 1cc513d
Backported to: 4.3.15
The text was updated successfully, but these errors were encountered: