diff options
author | Skip Wonnell <kw5258@att.com> | 2017-07-31 12:31:22 -0500 |
---|---|---|
committer | Skip Wonnell <kw5258@att.com> | 2017-07-31 13:24:41 -0500 |
commit | 771ac55e29d099d8bbf783612de975047d75ab12 (patch) | |
tree | 7d462fcc315eb3c8cc3bbe540b5089c881b14614 | |
parent | bfebc0599832ee03bfa74117d56cc66bb063ce00 (diff) |
Avoid possible NPEs in EventHandlerImpl.java
Change-Id: Id2c5fe1b07ecf1c6e7b70261daae8fa3955400e7
Signed-off-by: Skip Wonnell <kw5258@att.com>
Issue: APPC-98
-rw-r--r-- | appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/impl/EventHandlerImpl.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/impl/EventHandlerImpl.java b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/impl/EventHandlerImpl.java index 83f15bf53..1f1154f78 100644 --- a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/impl/EventHandlerImpl.java +++ b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/impl/EventHandlerImpl.java @@ -218,10 +218,12 @@ public class EventHandlerImpl implements EventHandler { //TODO:create eelf message LOG.error("EvenHandlerImp.getConsumer calling MessageAdapterFactor.createConsumer",e); } - for (String url : pool) { - if (url.contains("3905") || url.contains("https")) { - out.useHttps(true); - break; + if( out != null ) { + for (String url : pool) { + if (url.contains("3905") || url.contains("https")) { + out.useHttps(true); + break; + } } } } @@ -243,10 +245,12 @@ public class EventHandlerImpl implements EventHandler { ServiceReference svcRef = ctx.getServiceReference(MessageAdapterFactory.class.getName()); if (svcRef != null) { out = ((MessageAdapterFactory) ctx.getService(svcRef)).createProducer(pool, writeTopics,apiKey, apiSecret); - for (String url : pool) { - if (url.contains("3905") || url.contains("https")) { - out.useHttps(true); - break; + if( out != null ) { + for (String url : pool) { + if (url.contains("3905") || url.contains("https")) { + out.useHttps(true); + break; + } } } } |