jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Angela Schreiber <anch...@adobe.com>
Subject Re: Regarding NullLocation#getParent (was Re: svn commit: r1440930)
Date Thu, 31 Jan 2013 18:41:03 GMT
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?

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;
>>> +    }
>>

Mime
View raw message