[
https://issues.apache.org/jira/browse/SLING-7880?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stefan Seifert resolved SLING-7880.
-----------------------------------
Resolution: Fixed
fixed:
https://github.com/apache/sling-org-apache-sling-tenant/commit/80853919ca46788370ed98cce593345fad19d458
in this case it's safe to assume that the user has not tenant context, as it's
a system user and has not even access to it's own home directory. this should
*not* be logged as error.
> Avoid NPE when adapting to Tenant for a system users
> ----------------------------------------------------
>
> Key: SLING-7880
> URL: https://issues.apache.org/jira/browse/SLING-7880
> Project: Sling
> Issue Type: Bug
> Components: Extensions
> Affects Versions: Tenant 1.1.0
> Reporter: Stefan Seifert
> Assignee: Stefan Seifert
> Priority: Major
> Fix For: Tenant 1.1.2
>
>
> when trying to adapt a Resource to a tenant:
> {code:java}
> Tenant tenant = resourceResolver.adaptTo(Tenant.class);
> {code}
> this can lead to a NPE in the {{TenantAdapterFactory}} which is catched and
> logged:
> {noformat}
> 02.09.2018 11:14:27.586 *ERROR* [0:0:0:0:0:0:0:1 [1535879667510] GET
> /content/alpha64Project/en.html HTTP/1.1]
> org.apache.sling.tenant.internal.TenantAdapterFactory can not get user from
> session
> java.lang.NullPointerException: null
> at
> org.apache.sling.tenant.internal.TenantAdapterFactory.getAdapter(TenantAdapterFactory.java:122)
> at
> org.apache.sling.tenant.internal.TenantAdapterFactory.getAdapter(TenantAdapterFactory.java:101)
> at
> org.apache.sling.adapter.internal.AdapterManagerImpl.getAdapter(AdapterManagerImpl.java:143)
> at
> org.apache.sling.api.adapter.SlingAdaptable.adaptTo(SlingAdaptable.java:104)
> at
> org.apache.sling.resourceresolver.impl.ResourceResolverImpl.adaptTo(ResourceResolverImpl.java:818)
> ...
> {noformat}
> when the user of the resource resolver is a system user, and this user has no
> special access privileges to it's own home path.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)