jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting (JIRA)" <j...@apache.org>
Subject [jira] Updated: (JCR-2081) NameSet does not implement equals(Object) and hashCode() methods
Date Wed, 20 May 2009 17:25:47 GMT

     [ https://issues.apache.org/jira/browse/JCR-2081?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jukka Zitting updated JCR-2081:
-------------------------------

    Fix Version/s:     (was: 1.6.0)
                   1.5.6

Sure, merged to the 1.5 branch in revision 776771.

> NameSet does not implement equals(Object) and hashCode() methods
> ----------------------------------------------------------------
>
>                 Key: JCR-2081
>                 URL: https://issues.apache.org/jira/browse/JCR-2081
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.4
>         Environment: org.apache.jackrabbit.core.state.SharedItemStateManager:begin()
> org.apache.jackrabbit.core.state.NameSet:equals(Object)
> org.apache.jackrabbit.core.state.NodeStateMerger:merge(NodeState,MergeContext)
>            Reporter: Damon A. Brown
>            Priority: Critical
>             Fix For: 1.5.6
>
>
> The merge context uses the NameSet.equals(NameSet) method to compare two sets; however,
the NameSet class does not override the default Object.equals(Object) method, and does not
inherit from AbstractSet<E>.  Therefore, the merge check fails, even though the mixin
sets are the same.  Object instance equivalence is being performed as opposed to set equivalence.
 Behavior is observed when more than one thread is checking the ISM at a given time.  Demonstration
code available upon request.
> From NodeStateMerger, line 83:
>                 // mixin types
>                 if (!state.getMixinTypeNames().equals(overlayedState.getMixinTypeNames()))
{
>                     // the mixins have been modified but by just looking at the diff
we
>                     // can't determine where the change happened since the diffs of either
>                     // removing a mixin from the overlayed or adding a mixin to the
>                     // transient state would look identical...
>                     return false;
>                 }
> Proposed solution:
> - Implement NameSet.equals(...) method:
> 	public boolean equals(Object obj) {
> 		if (obj != null && obj instanceof NameSet) {
> 			NameSet oo = (NameSet) obj;
> 			return oo.names.equals(this.names);
> 		}
> 		return false;
> 	}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message