Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 22cc2a6da -> eaa74091e


Avoding a possible NPE in the async conduit factory


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/eaa74091
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/eaa74091
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/eaa74091

Branch: refs/heads/3.0.x-fixes
Commit: eaa74091e8d41939b6fdd72736e34c5352cbfacf
Parents: 22cc2a6
Author: Sergey Beryozkin <[email protected]>
Authored: Fri Aug 21 13:36:52 2015 +0100
Committer: Sergey Beryozkin <[email protected]>
Committed: Fri Aug 21 13:38:19 2015 +0100

----------------------------------------------------------------------
 .../asyncclient/AsyncHTTPConduitFactory.java    | 22 ++++++++++++--------
 1 file changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/eaa74091/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java
----------------------------------------------------------------------
diff --git 
a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java
 
b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java
index 089ed04..a5b94bf 100644
--- 
a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java
+++ 
b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java
@@ -282,15 +282,19 @@ public class AsyncHTTPConduitFactory implements 
HTTPConduitFactory {
 
 
     private void addListener(Bus b) {
-        
b.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(new 
BusLifeCycleListener() {
-            public void initComplete() {
-            }
-            public void preShutdown() {
-                shutdown();
-            }
-            public void postShutdown() {
-            }
-        });
+        BusLifeCycleManager manager = 
b.getExtension(BusLifeCycleManager.class);
+        if (manager != null) {
+            
+            manager.registerLifeCycleListener(new BusLifeCycleListener() {
+                public void initComplete() {
+                }
+                public void preShutdown() {
+                    shutdown();
+                }
+                public void postShutdown() {
+                }
+            });
+        }
     }
 
     public synchronized void setupNIOClient(HTTPClientPolicy clientPolicy) 
throws IOReactorException {

Reply via email to