incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r823465 - /sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/SlingAdaptable.java
Date Fri, 09 Oct 2009 08:55:37 GMT
Author: cziegeler
Date: Fri Oct  9 08:55:36 2009
New Revision: 823465

URL: http://svn.apache.org/viewvc?rev=823465&view=rev
Log:
SLING-1143 : Prevent NPE when adapter manager service is not running.

Modified:
    sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/SlingAdaptable.java

Modified: sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/SlingAdaptable.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/SlingAdaptable.java?rev=823465&r1=823464&r2=823465&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/SlingAdaptable.java
(original)
+++ sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/SlingAdaptable.java
Fri Oct  9 08:55:36 2009
@@ -20,6 +20,7 @@
 
 import org.apache.sling.adapter.internal.AdapterManagerImpl;
 import org.apache.sling.api.adapter.Adaptable;
+import org.apache.sling.api.adapter.AdapterManager;
 
 /**
  * The <code>SlingAdaptable</code> class is an (abstract) default
@@ -34,7 +35,8 @@
 public abstract class SlingAdaptable implements Adaptable {
 
     public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
-        return AdapterManagerImpl.getInstance().getAdapter(this, type);
+        final AdapterManager mgr = AdapterManagerImpl.getInstance();
+        return (mgr == null ? null : mgr.getAdapter(this, type));
     }
 
 }



Mime
View raw message