camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1155231 - /camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java
Date Tue, 09 Aug 2011 06:56:01 GMT
Author: ningjiang
Date: Tue Aug  9 06:56:01 2011
New Revision: 1155231

URL: http://svn.apache.org/viewvc?rev=1155231&view=rev
Log:
CAMEL-4299 Fixed the NPE issue of camel-cxfbean

Modified:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java?rev=1155231&r1=1155230&r2=1155231&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java
Tue Aug  9 06:56:01 2011
@@ -34,8 +34,11 @@ import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.phase.PhaseManager;
 import org.apache.cxf.transport.ConduitInitiatorManager;
 import org.apache.cxf.transport.DestinationFactoryManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * CXF Bean Endpoint is a {@link ProcessorEndpoint} which associated with 
@@ -45,6 +48,7 @@ import org.apache.cxf.transport.Destinat
  * @version 
  */
 public class CxfBeanEndpoint extends ProcessorEndpoint implements HeaderFilterStrategyAware
{
+     private static final Logger LOG = LoggerFactory.getLogger(CxfBeanEndpoint.class);
     private static final String URI_PREFIX = "cxfbean";
     private Server server;
     private Bus bus;
@@ -82,7 +86,14 @@ public class CxfBeanEndpoint extends Pro
         }
         
         if (bus == null) {
-            bus = BusFactory.newInstance().createBus();
+            ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+            try {
+                // Using the class loader of BusFactory to load the Bus
+                Thread.currentThread().setContextClassLoader(BusFactory.class.getClassLoader());
+                bus = BusFactory.newInstance().createBus();
+            } finally {
+                Thread.currentThread().setContextClassLoader(oldCL);
+            }
         }
         
         if (isSetDefaultBus) {



Mime
View raw message