You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (JIRA)" <ji...@apache.org> on 2018/09/02 09:20:00 UTC

[jira] [Created] (SLING-7880) Avoid NPE when adapting to Tenant for a system users

Stefan Seifert created SLING-7880:
-------------------------------------

             Summary: 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
             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)