From 771ac55e29d099d8bbf783612de975047d75ab12 Mon Sep 17 00:00:00 2001 From: Skip Wonnell Date: Mon, 31 Jul 2017 12:31:22 -0500 Subject: Avoid possible NPEs in EventHandlerImpl.java Change-Id: Id2c5fe1b07ecf1c6e7b70261daae8fa3955400e7 Signed-off-by: Skip Wonnell Issue: APPC-98 --- .../appc/listener/impl/EventHandlerImpl.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'appc-event-listener') 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; + } } } } -- cgit 1.2.3-korg