Content does not correctly implement equals()
---------------------------------------------
Key: MAGNOLIA-3005
URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-3005
Project: Magnolia
Issue Type: Bug
Components: core
Affects Versions: 4.2.3
Reporter: Nils Breunese
Assignee: Philipp Bärfuss
The Content class does not seem to correctly implement an equals() method.
Running the following Groovy code via the Groovy Shell returns false, while I
am pretty sure it should return true.
{code:title=ContentEqualsTest.groovy}
import info.magnolia.cms.util.*
def repository = "website"
def path = "/demo-project"
def c1 = ContentUtil.getContent(repository, path)
def c2 = ContentUtil.getContent(repository, path)
return c1.equals(c2)
{code}
Correctly implementing equals() and hashCode() is pretty important for working
with objects like these. I ran into this bug while filling a Set with
references to pages and noting that the same page was in the Set multiple
times. I haven't checked if there are more objects that do not correctly
implement equals() and/or hashCode(), but there may be more.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------