[
https://issues.apache.org/jira/browse/SLING-9850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17219639#comment-17219639
]
Robert Munteanu commented on SLING-9850:
----------------------------------------
[~kwin] - I agree, both should be {{@Nullable}} by looking at the code. That
being said, I'm not sure how we can not have at least one mapping, looking at
https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/657055bcb31059dc7b71cde55941fb2050cbaddb/src/main/java/org/apache/sling/resourceresolver/impl/mapping/ResourceMapperImpl.java#L125-L143
.
> 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)
