Hi,

both (annotations and jcr code) are correct :)

In the general case, the annotations in ResolveContext are correct and all those methods can return "null".

However, for resource providers requiring authentication, getProviderState() will return the object returned by ResourceProvider#authenticate and the jcr resource provider can safely assume that it will get this object there. Therefore null checks are not necessary in the implementation

Regards
Carsten

Am 14.11.2021 um 17:55 schrieb Konrad Windszus:
Hi,
according to 
https://github.com/apache/sling-org-apache-sling-api/blob/master/src/main/java/org/apache/sling/spi/resource/provider/ResolveContext.java
 all getter methods except for getResourceResolver() may return null.
Still e.g. in 
https://github.com/apache/sling-org-apache-sling-jcr-resource/blob/89bc0bb344d6c7f109f6e43ef5e87bda7c04d286/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java#L320
 their return values are very often dereferenced unconditionally.

Are the null annotation values/javadoc incorrect here or are there just null 
checks missing in JcrResourceProvider?

This came up in the context of https://issues.apache.org/jira/browse/SLING-10918

Thanks in advance for your input,
Konrad


--
Carsten Ziegeler
Adobe
[email protected]
aut

Reply via email to