summaryrefslogtreecommitdiffstats
path: root/services/services-engine/src/main
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@ericsson.com>2018-06-07 16:01:35 +0100
committerwaqas.ikram <waqas.ikram@ericsson.com>2018-06-08 11:48:06 +0100
commit6a9b54b275feff5369419a86997e94d0a95fc48e (patch)
tree8366bfb005057388b99c5639ed17496c881667f1 /services/services-engine/src/main
parent9289ac0afefe62f6c8e9cebddb611a8571bf5642 (diff)
Fixing Sonar bugs and Vulnerabilities
Change-Id: Id5a95f23f1308dbb9f7f0c0f5567e238ecf830af Issue-ID: POLICY-859 Signed-off-by: waqas.ikram <waqas.ikram@ericsson.com>
Diffstat (limited to 'services/services-engine/src/main')
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/engdep/EngDepMessageListener.java2
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java4
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java2
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java2
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParametersJSONAdapter.java7
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParametersJSONAdapter.java3
6 files changed, 16 insertions, 4 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/engdep/EngDepMessageListener.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/engdep/EngDepMessageListener.java
index 311e3b660..5c757c6d9 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/engdep/EngDepMessageListener.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/engdep/EngDepMessageListener.java
@@ -164,6 +164,8 @@ public class EngDepMessageListener implements MessageListener<Message>, Runnable
}
}
} catch (final InterruptedException e) {
+ // restore the interrupt status
+ Thread.currentThread().interrupt();
LOGGER.debug("message listener execution has been interrupted");
break;
}
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java
index b4ba2ac3e..9904847aa 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java
@@ -163,6 +163,8 @@ public class ApexEventMarshaller implements ApexEventListener, Runnable {
try {
queue.put(apexEvent);
} catch (final InterruptedException e) {
+ // restore the interrupt status
+ Thread.currentThread().interrupt();
LOGGER.warn("Failed to queue the event: " + apexEvent, e);
}
}
@@ -191,6 +193,8 @@ public class ApexEventMarshaller implements ApexEventListener, Runnable {
LOGGER.trace("event sent : " + apexEvent.toString());
}
} catch (final InterruptedException e) {
+ // restore the interrupt status
+ Thread.currentThread().interrupt();
LOGGER.debug("Thread interrupted, Reason {}", e.getMessage());
break;
} catch (final Exception e) {
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java
index a9385751e..7b4188ea1 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java
@@ -276,6 +276,8 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable {
// Pass the event to the activator for forwarding to Apex
engineServiceHandler.forwardEvent(apexEvent);
} catch (final InterruptedException e) {
+ // restore the interrupt status
+ Thread.currentThread().interrupt();
LOGGER.warn("BatchProcessor thread interrupted, Reason {}", e.getMessage());
break;
} catch (final Exception e) {
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java
index 20f8aaf75..f74c0f47b 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java
@@ -649,6 +649,8 @@ final class EngineWorker implements EngineService {
try {
event = eventProcessingQueue.take();
} catch (final InterruptedException e) {
+ // restore the interrupt status
+ Thread.currentThread().interrupt();
LOGGER.debug("Engine {} processing interrupted ", engineWorkerKey);
break;
}
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParametersJSONAdapter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParametersJSONAdapter.java
index 5aa7d6455..e72a283cd 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParametersJSONAdapter.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParametersJSONAdapter.java
@@ -124,9 +124,10 @@ public class CarrierTechnologyParametersJSONAdapter
// Check the carrier technology parameter class
if (carrierTechnologyParameterClassName == null || carrierTechnologyParameterClassName.length() == 0) {
- final String errorMessage =
- "carrier technology \"" + carrierTechnologyLabel + "\" parameter \"" + PARAMETER_CLASS_NAME
- + "\" value \"" + classNameJsonPrimitive.getAsString() + "\" invalid in JSON file";
+ final String errorMessage = "carrier technology \"" + carrierTechnologyLabel + "\" parameter \""
+ + PARAMETER_CLASS_NAME + "\" value \""
+ + (classNameJsonPrimitive != null ? classNameJsonPrimitive.getAsString() : "null")
+ + "\" invalid in JSON file";
LOGGER.warn(errorMessage);
throw new ApexParameterRuntimeException(errorMessage);
}
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParametersJSONAdapter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParametersJSONAdapter.java
index c880756b3..1f33db6b8 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParametersJSONAdapter.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParametersJSONAdapter.java
@@ -123,7 +123,8 @@ public class EventProtocolParametersJSONAdapter
if (eventProtocolParameterClassName == null || eventProtocolParameterClassName.length() == 0) {
final String errorMessage =
"event protocol \"" + eventProtocolLabel + "\" parameter \"" + PARAMETER_CLASS_NAME + "\" value \""
- + classNameJsonPrimitive.getAsString() + "\" invalid in JSON file";
+ + (classNameJsonPrimitive != null ? classNameJsonPrimitive.getAsString() : "null")
+ + "\" invalid in JSON file";
LOGGER.warn(errorMessage);
throw new ApexParameterRuntimeException(errorMessage);
}