You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2011/07/22 05:34:33 UTC
svn commit: r1149447 - in /cxf/branches/2.4.x-fixes: ./
rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
Author: ningjiang
Date: Fri Jul 22 03:34:33 2011
New Revision: 1149447
URL: http://svn.apache.org/viewvc?rev=1149447&view=rev
Log:
Merged revisions 1149444 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1149444 | ningjiang | 2011-07-22 11:18:39 +0800 (Fri, 22 Jul 2011) | 1 line
CXF-3678 Fixed the NPE error of BlueprintBeanLocator
........
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/BlueprintBeanLocator.java
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
svn:mergeinfo = /cxf/trunk:1149444
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/BlueprintBeanLocator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java?rev=1149447&r1=1149446&r2=1149447&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java (original)
+++ cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java Fri Jul 22 03:34:33 2011
@@ -25,12 +25,14 @@ import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
+import java.util.logging.Logger;
import org.apache.aries.blueprint.ExtendedBlueprintContainer;
import org.apache.aries.blueprint.container.BeanRecipe;
import org.apache.aries.blueprint.di.ExecutionContext;
import org.apache.aries.blueprint.di.Recipe;
import org.apache.cxf.bus.extension.ExtensionManagerImpl;
+import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.configuration.ConfiguredBeanLocator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -40,6 +42,7 @@ import org.osgi.service.blueprint.contai
*
*/
public class BlueprintBeanLocator implements ConfiguredBeanLocator {
+ private static final Logger LOG = LogUtils.getL7dLogger(BlueprintBeanLocator.class);
ConfiguredBeanLocator orig;
ExtendedBlueprintContainer container;
BundleContext context;
@@ -65,7 +68,7 @@ public class BlueprintBeanLocator implem
try {
for (String s : container.getComponentIds()) {
Recipe r = container.getRepository().getRecipe(s);
- if (r instanceof BeanRecipe
+ if (r instanceof BeanRecipe && ((BeanRecipe)r).getType() != null
&& type.isAssignableFrom(((BeanRecipe)r).getType())) {
names.add(s);
}
@@ -86,11 +89,11 @@ public class BlueprintBeanLocator implem
try {
for (String s : container.getComponentIds()) {
Recipe r = container.getRepository().getRecipe(s);
- if (r instanceof BeanRecipe
+ if (r instanceof BeanRecipe && ((BeanRecipe)r).getType() != null
&& type.isAssignableFrom(((BeanRecipe)r).getType())) {
list.add(type.cast(container.getComponentInstance(s)));
- }
+ }
}
} finally {
ExecutionContext.Holder.setContext(origContext);
@@ -106,6 +109,8 @@ public class BlueprintBeanLocator implem
}
} catch (Exception ex) {
//ignore, just don't support the OSGi services
+ LOG.info("Try to find the Bean with type:" + type
+ + " from OSGi services and get error: " + ex);
}
}
@@ -121,7 +126,7 @@ public class BlueprintBeanLocator implem
try {
for (String s : container.getComponentIds()) {
Recipe r = container.getRepository().getRecipe(s);
- if (r instanceof BeanRecipe
+ if (r instanceof BeanRecipe && ((BeanRecipe)r).getType() != null
&& type.isAssignableFrom(((BeanRecipe)r).getType())) {
names.add(s);
}