[ 
https://issues.apache.org/jira/browse/SLING-2457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13254008#comment-13254008
 ] 

Felix Meschberger commented on SLING-2457:
------------------------------------------

This is arguably not correct, yes.

Maybe the isA check should follow what the Servlet Resolver does (a special 
user is used to look the scripts up). Maybe even that same user should be used. 
So here is the proposal:

* The Servlet Resolver provides a ResourceDecorator which implements the 
isResourceType method using the servlet resolver user
* The ResourceUtil.isA method is modified as follows:
      - rename isA to a new package private isAInternal method 
      - create new isA method calling Resource.isResourceType first and on 
failure calls isAInternal
      - change AbstractResource.isResourceType to call new 
ResourceUtil.isAInternal directly
      - the o.a.s.resource package export micro version is incremented to 
signal this fix

The Servlet Resolver ResourceDecorator would be something like this:

  public Resource decorate(Resource r) {
     return new ResourceWrapper(r) {
        public boolean isResourceType(final String type) {
          return ResourceUtil.isA(new ResourceWrapper(getResource()) {
            public ResourceResolver getResourceResolver() {
              return servletResolverResourceResolver;
            }
          }, type);
     };
  };

(NB: The AbstractResource.getParent() and ResourceUtil.getParent(Resource) 
methods should probably also be modified analogous to the isResourceType and 
isA methods to allow for proper Resource decoration.)
                
> ResourceUtil.isA() fails if resource has a type, whose super type is not 
> readable
> ---------------------------------------------------------------------------------
>
>                 Key: SLING-2457
>                 URL: https://issues.apache.org/jira/browse/SLING-2457
>             Project: Sling
>          Issue Type: Bug
>          Components: API
>    Affects Versions: API 2.2.0
>            Reporter: Tyson Norris
>
> * define a resource at /content/component/foo whose type is 
> myapp/components/bar
> * define bar at /apps/myapp/components/bar
> * on /apps/myapp/components/bar, set sling:resourceSuperType as 
> /libs/components/bar2
> If resolver from resource.getResourceResolver() cannot access 
> /libs/components/bar2, then ResouceUtil.isA(resource, "components/bar2") 
> returns false, otherwise it returns true.
> There could be an argument that it should not return true in any case, 
> however, if you set resourceSuperType on resource as "components/bar2", then 
> it returns true with current implementation. 
> At least one of these is wrong, I think. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to