Details
-
Bug
-
Resolution: Won't Do
-
Major
-
None
-
4.2.3
Description
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.
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)
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.
Checklists
Acceptance criteria