You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (Jira)" <ji...@apache.org> on 2021/01/28 09:00:00 UTC

[jira] [Commented] (SLING-9230) Servlet should not be allowed to register with invalid ResourceTypes

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

Bertrand Delacretaz commented on SLING-9230:
--------------------------------------------

+1, from the Sling point of view resource types can be anything.

What might make sense is to define a regexp in the servlet registration code to match resource types and log those that do not follow desired conventions at a specified log level. But failing the registration sounds wrong.

> Servlet should not be allowed to register with invalid ResourceTypes
> --------------------------------------------------------------------
>
>                 Key: SLING-9230
>                 URL: https://issues.apache.org/jira/browse/SLING-9230
>             Project: Sling
>          Issue Type: Bug
>          Components: Servlets
>    Affects Versions: Servlets Resolver 2.6.4
>            Reporter: rafiya sirin
>            Priority: Minor
>         Attachments: Screen Shot 2020-03-10 at 10.12.54 PM.png, stacktrace.txt
>
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Servlets are allowed to register even when the resource types are specified as 
> SLING_SERVLET_RESOURCE_TYPES + "=" + "[/test,/path]"
> This is invalid because getOakPath for paths starting with "[" and ending with "]" return null. This creates an unwanted scenario where ResourceChangeListeners fail to register with a NPE. The NPE on JCR is fixed with commit : [https://github.com/apache/jackrabbit-oak/commit/2e37d7a507186484e13897549681bf29b17461fc] 
> However we should still fix this in sling, to not accept resource types which start with "[" and end with "]"
> JCR code which returns null : [https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/impl/NamePathMapperImpl.java#L91]
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)