Return-Path: X-Original-To: apmail-jackrabbit-oak-dev-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-oak-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A85B9EF82 for ; Fri, 1 Feb 2013 15:37:40 +0000 (UTC) Received: (qmail 52650 invoked by uid 500); 1 Feb 2013 15:37:40 -0000 Delivered-To: apmail-jackrabbit-oak-dev-archive@jackrabbit.apache.org Received: (qmail 51578 invoked by uid 500); 1 Feb 2013 15:37:36 -0000 Mailing-List: contact oak-dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-dev@jackrabbit.apache.org Delivered-To: mailing list oak-dev@jackrabbit.apache.org Received: (qmail 51547 invoked by uid 99); 1 Feb 2013 15:37:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Feb 2013 15:37:34 +0000 X-ASF-Spam-Status: No, hits=-1.6 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [64.18.1.37] (HELO exprod6og116.obsmtp.com) (64.18.1.37) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Feb 2013 15:37:24 +0000 Received: from outbound-smtp-2.corp.adobe.com ([193.104.215.16]) by exprod6ob116.postini.com ([64.18.5.12]) with SMTP ID DSNKUQvhHh2tiHaVOsw1tetup2lOTFra+nfw@postini.com; Fri, 01 Feb 2013 07:37:03 PST Received: from inner-relay-1.corp.adobe.com (inner-relay-1.corp.adobe.com [153.32.1.51]) by outbound-smtp-2.corp.adobe.com (8.12.10/8.12.10) with ESMTP id r11FaiC9009608 for ; Fri, 1 Feb 2013 07:36:44 -0800 (PST) Received: from nacas03.corp.adobe.com (nacas03.corp.adobe.com [10.8.189.121]) by inner-relay-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id r11FahAV008706 for ; Fri, 1 Feb 2013 07:36:43 -0800 (PST) Received: from eurhub01.eur.adobe.com (10.128.4.30) by nacas03.corp.adobe.com (10.8.189.121) with Microsoft SMTP Server (TLS) id 8.3.297.1; Fri, 1 Feb 2013 07:36:43 -0800 Received: from susi.local (10.136.129.63) by eurhub01.eur.adobe.com (10.128.4.111) with Microsoft SMTP Server id 8.3.297.1; Fri, 1 Feb 2013 15:36:41 +0000 Message-ID: <510BE109.90207@apache.org> Date: Fri, 1 Feb 2013 15:36:41 +0000 From: =?UTF-8?B?TWljaGFlbCBEw7xyaWc=?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: Subject: Re: Regarding NullLocation#getParent (was Re: svn commit: r1440930) References: <20130131123134.2BDEE23889ED@eris.apache.org> <510A6CD2.90103@adobe.com> <510A72B6.8030306@apache.org> <510ABABF.3040206@adobe.com> In-Reply-To: <510ABABF.3040206@adobe.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org On 31.1.13 18:41, Angela Schreiber wrote: > hi > > yes... that's correct, then getPath() should changed accordingly. > and so does the API definition, which currently states that getPath > would return null for non-existing items... > > i mean... the location has been accessed by specifying a path to > the Root or another TreeLocation and it somehow feels a bit strange, > that the location obtained would then return null, doesn't it? Not really. If you fall of the tree you stay on the ground unless you start climbing from the root again... What you propose is a different semantics in its own right for TreeLocation. That's why I'm reluctant with introducing it. It allows you to do things like getNode("/some/non/existent/path/../../../..) to get the root. While IMO this should not be possible, I just found out that this is the way JR2 works. I'll try the proposed changes and see where it leads to. Michael > > in addition it also allows to find out if the item doesn't exist > or is just not accessible (so, basically the same issue as we discussed > it for the NULL implementation earlier today)... same for getParent() > > or am i missing something? > > regards > angela > > > On 1/31/13 2:33 PM, Michael Dürig wrote: >> >> >> On 31.1.13 13:08, Angela Schreiber wrote: >>> hi michael >>> >>> while looking at the TreeLocation implementation was wondering about >>> NullLocation#getParent() as IMO it violates the API contract because >>> it always returns the NULL-location. is there a particular reason >>> for this? and wouldn't it be possible to return the original >>> parent location through which this NULL location had originally >>> be accessed? to me that would feel much more natural that having >>> a location that all in a sudden is isolated from the hierarchy. >>> >>> what do you think? >> >> The intention of NullLocation was to indicate that the path of >> navigation through which the NullLocation was obtained is invalid. But >> it is true that this somewhat contradicts the contract of getParent(). >> >> If we change this the way you propose, we need to keep track of a >> potential hierarchy of NullLocations. I.e. in the case someone calls >> getChild() on a NullLocation. If we do that, we should also change the >> contract of getPath() to not return null for NullLocations but rather >> the path of that location. Otherwise it is a bit funny that you can >> navigate from a location with a null path up the hierarchy to a location >> with a non null path. >> >> Michael >> >> >> >> >> >>> >>> regards >>> angela >>> >>>> + /** >>>> + * @return {@code NULL} >>>> + */ >>>> + @Override >>>> + public TreeLocation getParent() { >>>> + return NULL; >>>> + } >>>