incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r1052392 - in /incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container: BeanRecipe.java ServiceRecipe.java
Date Thu, 23 Dec 2010 22:13:45 GMT
Author: not
Date: Thu Dec 23 22:13:45 2010
New Revision: 1052392

URL: http://svn.apache.org/viewvc?rev=1052392&view=rev
Log:
ARIES-526 Fix NPE when proxying for JDK defined classes

Modified:
    incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java
    incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ServiceRecipe.java

Modified: incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java?rev=1052392&r1=1052391&r2=1052392&view=diff
==============================================================================
--- incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java
(original)
+++ incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java
Thu Dec 23 22:13:45 2010
@@ -680,7 +680,12 @@ public class BeanRecipe extends Abstract
         List<Interceptor> interceptors = reg.getInterceptors(interceptorLookupKey);
         if (interceptors != null && interceptors.size() > 0) {
             try {
-              intercepted = BlueprintExtender.getProxyManager().createProxy(FrameworkUtil.getBundle(original.getClass()),

+              Bundle b = FrameworkUtil.getBundle(original.getClass());
+              if (b == null) {
+                // we have a class from the framework parent, so use our bundle for proxying.
+                b = blueprintContainer.getBundleContext().getBundle();
+              }
+              intercepted = BlueprintExtender.getProxyManager().createProxy(b, 
                   ProxyUtils.asList(original.getClass()), ProxyUtils.passThrough(original),

                   new Collaborator(interceptorLookupKey, interceptors));
             } catch (org.apache.aries.proxy.UnableToProxyException e) {

Modified: incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ServiceRecipe.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ServiceRecipe.java?rev=1052392&r1=1052391&r2=1052392&view=diff
==============================================================================
--- incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ServiceRecipe.java
(original)
+++ incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ServiceRecipe.java
Thu Dec 23 22:13:45 2010
@@ -449,6 +449,10 @@ public class ServiceRecipe extends Abstr
             Object intercepted;
             try {
                 Bundle b = FrameworkUtil.getBundle(original.getClass());
+                if (b == null) {
+                  // we have a class from the framework parent, so use our bundle for proxying.
+                  b = blueprintContainer.getBundleContext().getBundle();
+                }
                 Callable<Object> target = ProxyUtils.passThrough(original);
                 InvocationHandlerWrapper collaborator = new Collaborator(cm, interceptors);
                 try {
@@ -464,7 +468,8 @@ public class ServiceRecipe extends Abstr
                         classes, target, collaborator);
                 }
             } catch (Throwable u) {
-                LOGGER.info("A problem occurred trying to create a proxy object. Returning
the original object instead.", u);
+                Bundle b = blueprintContainer.getBundleContext().getBundle();
+                LOGGER.info("Unable to create a proxy object for the service " + getName()
+ " defined in bundle " + b.getSymbolicName() + " at version " + b.getVersion() + " with id
" + b.getBundleId() + ". Returning the original object instead.", u);
                 LOGGER.debug(LOG_EXIT, "getService", original);
                 return original;
             }



Mime
View raw message