Actually what I was proposing was rather to modify isResourceType(String) like
this
Resource.isResourceType(String type) {
if (!type.startsWith("/")) {
if (type.equals(this.getResourceType()) {
return true
}
for (String prefix : rr.getSearchPaths()) {
if (this.getResourceType().equals(prefix + type) {
return true;
}
}
} else {
return type.equals(this.getResourceType());
}
So no change for absolute resource paths given as parameter but only for
relative resource paths.
How does that sound?
Konrad
> On 24 Nov 2016, at 14:23, Bertrand Delacretaz <[email protected]> wrote:
>
> On Thu, Nov 24, 2016 at 1:33 PM, Konrad Windszus <[email protected]> wrote:
>> ...for resourceA with resourceType = "sling/some/type",
>> resourceA.isResourceType("/libs/sling/some/type") would return false...
>
> IMO using both absolute and relative resource types as in your example
> is a bad idea, I think one should always use relative paths in
> resource types, but you're right that we cannot control that.
>
> IIUC what you suggest is to take the search path into account - if an
> absolute resource type path is provided, remove any prefix that
> matches a search path element before comparing.
>
> That sounds reasonable and if breaks something we might argue that
> that thing deserved to be broken...
>
> I'm +1 on this change if it doesn't break any of our tests, and if we
> have strong test coverage before and after.
>
> -Bertrand