Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 19796 invoked from network); 28 Feb 2007 13:38:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Feb 2007 13:38:05 -0000 Received: (qmail 15218 invoked by uid 500); 28 Feb 2007 13:38:13 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 15184 invoked by uid 500); 28 Feb 2007 13:38:13 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 15175 invoked by uid 99); 28 Feb 2007 13:38:13 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Feb 2007 05:38:13 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of marcel.reutegger@gmx.net designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 28 Feb 2007 05:38:02 -0800 Received: (qmail invoked by alias); 28 Feb 2007 13:37:40 -0000 X-Provags-ID: V01U2FsdGVkX1+Esawk0xSE4eUpf/RaTO+ZsG92OP7fcbt47mUDur h88g== Message-ID: <45E585A2.7060703@gmx.net> Date: Wed, 28 Feb 2007 14:37:38 +0100 From: Marcel Reutegger User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: dev@jackrabbit.apache.org Subject: Re: svn commit: r512695 - in /jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons: AbstractItem.java AbstractNode.java AbstractProperty.java References: <20070228104214.99A281A981A@eris.apache.org> In-Reply-To: <20070228104214.99A281A981A@eris.apache.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Checked: Checked by ClamAV on apache.org Hi Jukka, 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. iirc the same also applies to getAncestor(int depth). regards marcel jukka@apache.org wrote: > Author: jukka > Date: Wed Feb 28 02:42:13 2007 > New Revision: 512695 > > + > + /** > + * Returns the depth of this item. > + *

> + * Recursively calls the method on the parent node and increments > + * the return value to get the depth of this item. Returns zero if > + * the parent node is not available (i.e. this is the root node). > + * > + * @return depth of this item > + * @throws RepositoryException if an error occurs > + */ > + public int getDepth() throws RepositoryException { > + try { > + return getParent().getDepth() + 1; > + } catch (ItemNotFoundException e) { > + return 0; > + } > + } > + > +}