summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-08-27 15:24:06 -0400
committerJim Hahn <jrh3@att.com>2021-08-27 16:08:00 -0400
commitf4580fa8a931c84b36d59e2ef853d1fba3d5917e (patch)
tree0c6a047fadfa26898af614460ac8699f2aa4a4ab /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms
parent9d8894092ced589c0bdc5b9e85ee1bf1c85d3e36 (diff)
Fix sonars in apex-pdp #2
plugins-events thru plugins-persistence-jpa-eclipselink Fixed: - use "var" - disambiguate method parameter types - rename parameter Issue-ID: POLICY-3093 Change-Id: Ife5897015be495403e731754d5862b803a217c87 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java17
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java2
3 files changed, 9 insertions, 12 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java
index 4bad4cb7a..2bca82eb6 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +26,6 @@ import java.util.Properties;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Message;
-import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.Session;
import javax.jms.Topic;
@@ -141,11 +141,11 @@ public class ApexJmsConsumer extends ApexPluginsEventConsumer implements Message
@Override
public void run() {
// JMS session and message consumer for receiving messages
- try (final Session jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE)) {
+ try (final var jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE)) {
// Create a message consumer for reception of messages and set this class as a message listener
createMessageConsumer(jmsSession);
} catch (final Exception exc) {
- final String errorMessage = "failed to create a JMS session towards the JMS server for receiving messages";
+ final var errorMessage = "failed to create a JMS session towards the JMS server for receiving messages";
throw new ApexEventRuntimeException(errorMessage, exc);
}
// Everything is now set up
@@ -161,7 +161,7 @@ public class ApexJmsConsumer extends ApexPluginsEventConsumer implements Message
* @param jmsSession a JMS session
*/
private void createMessageConsumer(final Session jmsSession) {
- try (final MessageConsumer messageConsumer = jmsSession.createConsumer(jmsIncomingTopic)) {
+ try (final var messageConsumer = jmsSession.createConsumer(jmsIncomingTopic)) {
messageConsumer.setMessageListener(this);
// The endless loop that receives events over JMS
@@ -169,8 +169,7 @@ public class ApexJmsConsumer extends ApexPluginsEventConsumer implements Message
ThreadUtilities.sleep(jmsConsumerProperties.getConsumerWaitTime());
}
} catch (final Exception exc) {
- final String errorMessage = "failed to create a JMS message consumer for receiving messages";
- throw new ApexEventRuntimeException(errorMessage, exc);
+ throw new ApexEventRuntimeException("failed to create a JMS message consumer for receiving messages", exc);
}
}
@@ -188,8 +187,7 @@ public class ApexJmsConsumer extends ApexPluginsEventConsumer implements Message
eventReceiver.receiveEvent(new Properties(), jmsMessage);
} catch (final Exception e) {
- final String errorMessage = "failed to receive message from JMS";
- throw new ApexEventRuntimeException(errorMessage, e);
+ throw new ApexEventRuntimeException("failed to receive message from JMS", e);
}
}
@@ -210,8 +208,7 @@ public class ApexJmsConsumer extends ApexPluginsEventConsumer implements Message
connection.close();
}
} catch (final Exception e) {
- final String errorMessage = "close of connection to the JMS server failed";
- LOGGER.warn(errorMessage, e);
+ LOGGER.warn("close of connection to the JMS server failed", e);
}
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java
index 42bde24ca..21309396a 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java
@@ -197,7 +197,7 @@ public class ApexJmsProducer implements ApexEventProducer {
public void sendEvent(final long executionId, final Properties executionProperties, final String eventname,
final Object eventObject) {
// Check if this is a synchronized event, if so we have received a reply
- final SynchronousEventCache synchronousEventCache = (SynchronousEventCache) peerReferenceMap
+ final var synchronousEventCache = (SynchronousEventCache) peerReferenceMap
.get(EventHandlerPeeredMode.SYNCHRONOUS);
if (synchronousEventCache != null) {
synchronousEventCache.removeCachedEventToApexIfExists(executionId);
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java
index 3e2f239df..42ff67df1 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java
@@ -159,7 +159,7 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters
* @return the jms consumer properties
*/
private Properties getJmsProperties() {
- final Properties jmsProperties = new Properties();
+ final var jmsProperties = new Properties();
jmsProperties.put(PROPERTY_INITIAL_CONTEXT_FACTORY, initialContextFactory);