Hi,
On Wed, 2016-06-01 at 13:29 +0200, Konrad Windszus wrote:
> Hi,
> I have a question around the getParent() method on a
> NonExistingResource.
> Currently it returns null in case the parent is also a non existing
> resource.
> 
> According to the javadoc of Resource.getParent() this is kind of
> unexpected, because it states (https://github.com/apache/sling/blob/t
> runk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource
> .java#L89)
> ...
> Returns the parent resource or <code>null</code> if this resource
> * represents the root of the resource tree.
> ...
> Derived from that I would assume that a NonExistingResource would
> also return a NonExistingResource as result of getParent() in case
> the parent does not exist either instead of returning null (which it
> does right now).

I would cautiously agree with this approach as it's more natural from
an API consumer point of view.

I am not sure whether this would confuse existing clients though...

Thanks,

Robert

> 
> In case the behaviour of returning null is deliberate, we should
> clarify the javadoc of Resource.getParent() with the additional
> conditions when this method may return null.
> WDYT?
> 
> Thanks,
> Konrad

Reply via email to