You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by ji...@apache.org on 2004/10/15 16:42:52 UTC

[jira] Resolved: (JCR-9) Version.isSame(Object) not working

Message:

   The following issue has been resolved as FIXED.

   Resolver: Tobias Strasser
       Date: Fri, 15 Oct 2004 7:41 AM

check is now done in derived classes.

fixed. (r54853)
---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/JCR-9

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: JCR-9
    Summary: Version.isSame(Object) not working
       Type: Bug

     Status: Resolved
   Priority: Major
 Resolution: FIXED

    Project: Jackrabbit

   Assignee: Tobias Strasser
   Reporter: Felix Meschberger

    Created: Fri, 15 Oct 2004 5:15 AM
    Updated: Fri, 15 Oct 2004 7:41 AM
Environment: Jackrabbit SVN revision 54847

Description:
Version interface is implemented (on the frontend) by the VersionImpl class (extending NodeWrapper), which delegates to an internal NodeImpl class, which in turn extends ItemImpl.

Say you have :
      Node node = // at Version 1.0
      Version version = // retrieved as 1.0 for the node
      Version baseVersion = node.getBaseVersion()

You now expect
      baseVersion.isSame(version)
even if
      baseVersion != version

This fails, because VersionImpl delegates the isSame call to its delegatee, thus above call becomes
      ((VersionImpl) baseVersion).delegatee.isSame(version)
where this method is implemented by the ItemImpl class from which the delegatee NodeImpl extends.

That latter implementation ItemImpl.isSame() only returns true if the other is an ItemImpl, too. But this is not the case because VersionImpl is a Version, NodeWrapper, Node but not an ItemImpl.

Probably the best solution would be for NodeImpl.isSame() to check whether the otherItem is a NodeWrapper und use ((NodeWrapper) otherItem).delegatee as the otherItem for the delegatee call.

On another track: ItemImpl.isSame() should probably do a fast check whether the otherItem is actually the same instance to prevent type checks...


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira