cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1341887 - in /cxf/branches/2.4.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/bus/blueprint/ConfigurerImpl.java
Date Wed, 23 May 2012 14:58:10 GMT
Author: ay
Date: Wed May 23 14:58:09 2012
New Revision: 1341887

URL: http://svn.apache.org/viewvc?rev=1341887&view=rev
Log:
Merged revisions 1341880 via  svn merge from
https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes

........
  r1341880 | ay | 2012-05-23 16:52:05 +0200 (Wed, 23 May 2012) | 9 lines
  
  Merged revisions 1341877 via  svn merge from
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1341877 | ay | 2012-05-23 16:44:54 +0200 (Wed, 23 May 2012) | 1 line
    
    [CXF-4336] org.apache.cxf.bus.blueprint.ConfigurerImpl may get IllegalStateException
  ........
  
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/blueprint/ConfigurerImpl.java

Propchange: cxf/branches/2.4.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/blueprint/ConfigurerImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/blueprint/ConfigurerImpl.java?rev=1341887&r1=1341886&r2=1341887&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/blueprint/ConfigurerImpl.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/blueprint/ConfigurerImpl.java
Wed May 23 14:58:09 2012
@@ -132,11 +132,20 @@ public class ConfigurerImpl implements C
                 m = ReflectionUtil.findMethod(container.getClass(), "getRepository");
                 Object o = ReflectionUtil.setAccessible(m).invoke(container);
                 m = ReflectionUtil.findMethod(o.getClass(), "getRecipe", String.class);
+                Object xc = o;
                 o = ReflectionUtil.setAccessible(m).invoke(o, bn);  //returns the recipe
                 if (o != null) {
                     m = ReflectionUtil.findMethod(o.getClass(), "setProperties", Object.class);
                     if (m != null) {
-                        ReflectionUtil.setAccessible(m).invoke(o, beanInstance);
+                        Method xcm = findSetExecutionContextMethod(o.getClass().getClassLoader());
+                        if (xcm != null) {
+                            Object oxc = xcm.invoke(null, xc);
+                            try {
+                                ReflectionUtil.setAccessible(m).invoke(o, beanInstance);
+                            } finally {
+                                xcm.invoke(null, oxc);
+                            }
+                        }
                     }
                 }
             }
@@ -151,6 +160,20 @@ public class ConfigurerImpl implements C
             LOG.log(Level.FINE, "Could not configure object " + bn, ex);
         }
     }
+    
+    // for Aries blueprint 0.3.1
+    private Method findSetExecutionContextMethod(ClassLoader cl) {
+        Method m = null;
+        try {
+            m = Class.forName("org.apache.aries.blueprint.di.ExecutionContext$Holder", false,
cl).
+                getDeclaredMethod("setContext", 
+                                  Class.forName("org.apache.aries.blueprint.di.ExecutionContext",
false, cl));
+        } catch (Exception e) {
+            LOG.log(Level.FINE, "Could not find the ExecutionContext$Holder.setContext method",
e);
+        }
+        return m;
+    }
+    
     private void configureWithWildCard(String bn, Object beanInstance) {
         if (!wildCardBeanDefinitions.isEmpty()) {
             Class<?> clazz = beanInstance.getClass();            



Mime
View raw message