felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1592800 - /felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
Date Tue, 06 May 2014 16:37:45 GMT
Author: clement
Date: Tue May  6 16:37:45 2014
New Revision: 1592800

URL: http://svn.apache.org/r1592800
Log:
Fix FELIX-4488

Modified:
    felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java

Modified: felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java?rev=1592800&r1=1592799&r2=1592800&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
(original)
+++ felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
Tue May  6 16:37:45 2014
@@ -55,7 +55,7 @@ public class Dependency extends Dependen
      */
     private final String m_exception;
     /**
-     * Is the Nullable pattern enable?
+     * Is the Nullable pattern enabled?
      */
     private final boolean m_supportNullable;
     /**
@@ -419,6 +419,12 @@ public class Dependency extends Dependen
     private Object createNullableObject() {
         // To load the proxy we use the POJO class loader. Indeed, this classloader imports
iPOJO (so can access to Nullable) and has
         // access to the service specification.
+        if ( ! getSpecification().isInterface()) {
+            getHandler().getLogger().log(Log.INFO, "Cannot create the nullable object for
" + getSpecification()
+                    .getName() + " - the specification is not an interface");
+            return null;
+        }
+
         try {
             ClassLoader cl = new NullableClassLoader(
                     getHandler().getInstanceManager().getClazz().getClassLoader(),
@@ -483,7 +489,7 @@ public class Dependency extends Dependen
 
                     if (type == null || type.equals(DependencyHandler.SMART_PROXY)) {
                         SmartProxyFactory proxyFactory = new SmartProxyFactory(this.getClass().getClassLoader());
-                        m_proxyObject = proxyFactory.getProxy(getSpecification(), this);
+                        m_proxyObject = proxyFactory.getProxy(this);
                     } else {
                         DynamicProxyFactory proxyFactory = new DynamicProxyFactory();
                         m_proxyObject = proxyFactory.getProxy(getSpecification());
@@ -1106,11 +1112,10 @@ public class Dependency extends Dependen
          * Create a proxy object for the given specification. The proxy
          * uses the given dependency to get the service object.
          *
-         * @param spec the service specification (interface)
          * @param dep  the dependency used to get the service
          * @return the proxy object.
          */
-        public Object getProxy(Class spec, Dependency dep) {
+        public Object getProxy(Dependency dep) {
             try {
                 Class clazz = getProxyClass(getSpecification());
                 Constructor constructor = clazz.getConstructor(



Mime
View raw message