summaryrefslogtreecommitdiffstats
path: root/core/core-engine/src
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 /core/core-engine/src
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 'core/core-engine/src')
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java21
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java2
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java2
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java2
4 files changed, 12 insertions, 15 deletions
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java
index 2274b7c23..aaec71b47 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java
@@ -34,7 +34,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput;
import org.onap.policy.apex.model.utilities.Assertions;
/**
- * This class is the output of a state, and is used by the engine to decide what the next state for execution is.
+ * This class is the output of a state, and is used by the engine to decide what the next state for
+ * execution is.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -115,15 +116,11 @@ public class StateOutput {
for (final Entry<String, Object> incomingFieldEntry : eventFieldMap.entrySet()) {
final String fieldName = incomingFieldEntry.getKey();
final AxField fieldDef = incomingFieldDefinitionMap.get(fieldName);
- try {
-
- // Check if this field is a field in the event
- if (!outputEventDef.getFields().contains(fieldDef)) {
- throw new StateMachineException(
- "field \"" + fieldName + "\" does not exist on event \"" + outputEventDef.getID() + "\"");
- }
- } catch (final Exception e) {
- e.printStackTrace();
+
+ // Check if this field is a field in the event
+ if (!outputEventDef.getFields().contains(fieldDef)) {
+ throw new StateMachineException(
+ "field \"" + fieldName + "\" does not exist on event \"" + outputEventDef.getID() + "\"");
}
// Set the value in the output event
@@ -132,8 +129,8 @@ public class StateOutput {
}
/**
- * This method copies any fields that exist on the input event that also exist on the output event if they are not
- * set on the output event.
+ * This method copies any fields that exist on the input event that also exist on the output
+ * event if they are not set on the output event.
*
* @param incomingEvent The incoming event to copy from
*/
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java
index 226f06ade..80d7e651b 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java
@@ -40,7 +40,7 @@ public class AxStateFacade {
// CHECKSTYLE:OFF: checkstyle:visibilityModifier Logic has access to this field
/** The full definition information for the state. */
- public AxState state;
+ public final AxState state;
// CHECKSTYLE:ON: checkstyle:visibilityModifier
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java
index 015f3ae80..85bf96c8d 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java
@@ -46,7 +46,7 @@ public class AxTaskFacade {
* The full definition of the task we are presenting a facade to, executing logic has full access to the task
* definition.
*/
- public AxTask task;
+ public final AxTask task;
// CHECKSTYLE:ON: checkstyle:visibilityModifier
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
index 2e5971142..874d4def1 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
@@ -70,7 +70,7 @@ public class StateFinalizerExecutionContext {
* fields to determine what state output to select. Once a state finalizer has selected a state output, it must
* marshal these fields so that they match the fields required for the event defined in the state output.
*/
- public Map<String, Object> fields;
+ public final Map<String, Object> fields;
// A message specified in the logic
private String message;