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

Konrad Windszus commented on SLING-9850:
----------------------------------------

I think we should mark both as {{@NotNull}} and clarify that in the javadocs as 
well. As fallback you always get back the original passed String (no matter if 
it starts with "/" or even a scheme). The implementation seems to be in line 
with this. WDYT?

> Clarify null return values for ResourceResolver.map(...)
> --------------------------------------------------------
>
>                 Key: SLING-9850
>                 URL: https://issues.apache.org/jira/browse/SLING-9850
>             Project: Sling
>          Issue Type: Improvement
>          Components: API
>    Affects Versions: API 2.23.0
>            Reporter: Konrad Windszus
>            Priority: Major
>
> Currently the two signatures of {{map}} differ by their null return 
> annotation:
> - 
> https://github.com/apache/sling-org-apache-sling-api/blob/3e9cf187eff999235ee161e0543f1d8a68c4285c/src/main/java/org/apache/sling/api/resource/ResourceResolver.java#L294
>  (must not return null)
> and
> - 
> https://github.com/apache/sling-org-apache-sling-api/blob/3e9cf187eff999235ee161e0543f1d8a68c4285c/src/main/java/org/apache/sling/api/resource/ResourceResolver.java#L332
>  (may return null)
> The implementation of both may return null though in fact, IIU
> https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/657055bcb31059dc7b71cde55941fb2050cbaddb/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java#L40,
>  
> https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/657055bcb31059dc7b71cde55941fb2050cbaddb/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java#L420
>  and 
> https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/657055bcb31059dc7b71cde55941fb2050cbaddb/src/main/java/org/apache/sling/resourceresolver/impl/mapping/ResourceMapperImpl.java#L75
>  correctly.
> The javadoc for both methods should be clarified with regards to when to 
> expect a null value and most probably the null annotations need to be fixed 
> as well. 



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

Reply via email to