[
https://issues.apache.org/jira/browse/SLING-164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Carsten Ziegeler closed SLING-164.
----------------------------------
Resolution: Fixed
This issue has been fixed some minutes ago.
> JcrResourceResolver.adaptTo(ObjectContentManager.class) returns (in most
> cases) null
> ------------------------------------------------------------------------------------
>
> Key: SLING-164
> URL: https://issues.apache.org/jira/browse/SLING-164
> Project: Sling
> Issue Type: Bug
> Components: Resource
> Reporter: Philipp Koch
> Priority: Critical
>
> the adaptTo method returns currently the value set in the
> objectContentManager field. this field might not be initialized (in most
> cases) resp. set to null.
> the below pasted fix should solve the problem.
> @SuppressWarnings("unchecked")
> public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
> if (type == Session.class) {
> return (AdapterType) getSession();
> } else if (type == ObjectContentManager.class) {
> return (AdapterType) getObjectContentManager();
> } else if (type == PathResolver.class) {
> return (AdapterType) this;
> }
> // no adapter available
> return null;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.