jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: svn commit: r512695 - in /jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons: AbstractItem.java AbstractNode.java AbstractProperty.java
Date Wed, 28 Feb 2007 13:50:58 GMT
Hi,

On 2/28/07, Marcel Reutegger <marcel.reutegger@gmx.net> wrote:
> please note that getParent() may also throw an access denied exception, in case
> the session does not have sufficient access rights for an ancestor. however
> getDepth() should still succeed in that case.

Hmm, good point. I think it's a valid option to let getDepth() throw a
RepositoryException (by just passing through the
AccessDeniedException) to indicate that the depth of the item can not
be calculcated in such cases.

> iirc the same also applies to getAncestor(int depth).

And Item.getPath(). In fact, I'd argue that if getPath() is allowed to
return the path of an item, then there is no good reason to prevent
getParent() since the getPath() call already discloses more
information about the parent node than what getParent() without any
other method calls (which would of course be access controlled) does.

> > +    public int getDepth() throws RepositoryException {
> > +        try {
> > +            return getParent().getDepth() + 1;
> > +        } catch (ItemNotFoundException e) {
> > +            return 0;
> > +        }
> > +    }

BR,

Jukka Zitting

Mime
View raw message