[dna-issues] [JBoss JIRA] Commented: (DNA-551) graph.Location's equals(Object) and hashCode() Methods Are Not Consistent

Randall Hauch (JIRA) jira-events at lists.jboss.org
Wed Nov 25 12:37:35 EST 2009


    [ https://jira.jboss.org/jira/browse/DNA-551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12496704#action_12496704 ] 

Randall Hauch commented on DNA-551:
-----------------------------------

I've reviewed the patch, and there are several problems.

One federation unit test in 'dna-graph' is failing because the patch changes the behavior of some of the Location.create(...) methods that take an identification Property.  The patch was looking for the case where the supplied ID property has a name of "dna:uuid" and created a LocationWithPathAndUuid using the path and the first value of the ID property.  So if the ID property contains multiple UUIDs (as is the case in the federation case, when merging nodes with the same path but different UUIDs from multiple sources), then the UUID values other than the first were lost.

Another problem with the patch is that the Location.create(Path,UUID) method was checking for a null UUID and creating a Location properly (with just the Path) but was not returning it, so the method continued to create a LocationWithPathAndUuid using the path and null UUID reference.  This of course fails on the assertion (if assertions are enabled when running the tests).

Fixing these (locally) resulted in no unit test failures in 'dna-graph' or 'dna-repository'.  However, even with these fixes there is one TCK test failure in WorkspaceCloneTest.testCloneNodesTwice(), with the error:

javax.jcr.PathNotFoundException: Unable to find "{}testroot/{}node2/{}node1/{}node3"; lowest existing path is "/{}testroot/{}node2": Unable to find "{}testroot/{}node2/{}node1/{}node3"; lowest existing path is "/{}testroot/{}node2": Unable to find "{}testroot/{}node2/{}node1/{}node3"; lowest existing path is "/{}testroot/{}node2"
	at org.jboss.dna.jcr.JcrWorkspace.clone(JcrWorkspace.java:401)
	at org.apache.jackrabbit.test.api.WorkspaceCloneTest.testCloneNodesTwice(WorkspaceCloneTest.java:64)

I'll continue to investigate this error.

> graph.Location's equals(Object) and hashCode() Methods Are Not Consistent
> -------------------------------------------------------------------------
>
>                 Key: DNA-551
>                 URL: https://jira.jboss.org/jira/browse/DNA-551
>             Project: DNA
>          Issue Type: Bug
>          Components: Graph
>    Affects Versions: 0.6
>            Reporter: Dan Florian
>            Priority: Blocker
>             Fix For: 0.7
>
>         Attachments: DNA-551-patch1.txt
>
>
> Location.hashCode() and Location.equals(Object) need to be consistent. The current implementation of the base class and subclasses prevent logically equal locations (same path or same ID properties) from being used java.util.Map objects.
> It should be true that if one subtype of Location has the same path as a different subtype of Location, and only one of these objects has ID properties, those locations should be equal and should have the same hashCode.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the dna-issues mailing list