Fix all blocker sonar issues and some checkstyle
[aai/aai-common.git] / aai-core / src / main / java / org / onap / aai / dmaap / AAIDmaapEventJMSProducer.java
index eb0d165..3d675ef 100644 (file)
@@ -47,7 +47,9 @@ public class AAIDmaapEventJMSProducer implements MessageProducer {
         if (jmsTemplate != null) {
             jmsTemplate.convertAndSend(finalJson.toString());
             CachingConnectionFactory ccf = (CachingConnectionFactory) this.jmsTemplate.getConnectionFactory();
-            ccf.destroy();
+            if (ccf != null) {
+                ccf.destroy();
+            }
         }
     }
 
@@ -55,7 +57,9 @@ public class AAIDmaapEventJMSProducer implements MessageProducer {
         if (jmsTemplate != null) {
             jmsTemplate.convertAndSend(msg);
             CachingConnectionFactory ccf = (CachingConnectionFactory) this.jmsTemplate.getConnectionFactory();
-            ccf.destroy();
+            if (ccf != null) {
+                ccf.destroy();
+            }
         }
     }
 }