jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Bocanegra <tri...@apache.org>
Subject Re: svn commit: r1532157 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeEqualsTest.java
Date Tue, 15 Oct 2013 18:04:22 GMT
Hi Michael, thanks for reviewing this.


On Tue, Oct 15, 2013 at 12:49 AM, Michael Dürig <mduerig@apache.org> wrote:

> Hi,
>
> On 15.10.13 2:42 , tripod@apache.org wrote:
>
>> Author: tripod
>> Date: Tue Oct 15 00:42:21 2013
>> New Revision: 1532157
>>
>> URL: http://svn.apache.org/r1532157
>> Log:
>> OAK-1086 NodeTypes of successive calls to node.getPrimaryNodetypes() are
>> not equal
>>
>> - implement equals and hashcode based on the CND of the node type
>> definition.
>>
>
> [...]
>
>  +    @Override
>> +    public boolean equals(Object o) {
>> +        if (this == o) return true;
>> +        if (o instanceof NodeTypeImpl) {
>> +            return getCnd().equals(((**NodeTypeImpl) o).getCnd());
>> +        } else if (o instanceof NodeType) {
>>
>
> Should we even consider this case? If so, below implementation is not
> symmetric wrt. e.g. the NodeType implementation of JR2.
>

I think the semantics of NodeType.equals() should be mentioned in the JCR
API. I'm indifferent if we should consider the comparison between 2
different implementations.


> I'd rather return false for unknown NodeType instances.
>
ok. Maybe we could add a NodeTypeComparator() to JCR commons that can do
this check. Initially I thought that comparing just the names would be
enough, but then it wouldn't work correctly when a 2 nodetypes of different
sessions are compared that were modified. for the implementation specific
comparison, we could use the revision/hash of the definition tree.


>
>  +            try {
>> +                return getCnd().equals(getCnd((**NodeType) o));
>> +            } catch (IOException e) {
>> +                return false;
>> +            }
>> +        } else {
>> +            return false;
>> +        }
>> +    }
>>
>
> Michael
>

Regards, Toby

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message