From 4cfa2e2d98f6877d54da304ef17f096284430908 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Thu, 13 Sep 2018 15:25:32 +0100 Subject: Sonar/Checkstyle in service/plugins Sonar and Checkstyle changes in plugins and services, and knock on changes Issue-ID: POLICY-1034 Change-Id: Iff7df74e54fce2c661dcc2fae75ae93d4cacfe5b Signed-off-by: liamfallon --- .../executor/jython/JythonStateFinalizerExecutor.java | 6 +++--- .../apex/plugins/executor/jython/JythonTaskExecutor.java | 6 +++--- .../executor/jython/JythonTaskSelectExecutor.java | 16 ++++++++++------ 3 files changed, 16 insertions(+), 12 deletions(-) (limited to 'plugins/plugins-executor/plugins-executor-jython') diff --git a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutor.java index ea8f027c5..ecd9f7ae1 100644 --- a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutor.java +++ b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutor.java @@ -75,20 +75,20 @@ public class JythonStateFinalizerExecutor extends StateFinalizerExecutor { /** * Executes the executor for the state finalizer logic in a sequential manner. * - * @param executionID the execution ID for the current APEX policy execution + * @param executionId the execution ID for the current APEX policy execution * @param incomingFields the incoming fields for finalisation * @return The state output for the state * @throws StateMachineException on an execution error * @throws ContextException on context errors */ @Override - public String execute(final long executionID, final Map incomingFields) + public String execute(final long executionId, final Map incomingFields) throws StateMachineException, ContextException { boolean returnValue = false; // Do execution pre work - executePre(executionID, incomingFields); + executePre(executionId, incomingFields); try { diff --git a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java index e1c0f096a..39ca0dc43 100644 --- a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java +++ b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java @@ -77,20 +77,20 @@ public class JythonTaskExecutor extends TaskExecutor { /** * Executes the executor for the task in a sequential manner. * - * @param executionID the execution ID for the current APEX policy execution + * @param executionId the execution ID for the current APEX policy execution * @param incomingFields the incoming fields * @return The outgoing fields * @throws StateMachineException on an execution error * @throws ContextException on context errors */ @Override - public Map execute(final long executionID, final Map incomingFields) + public Map execute(final long executionId, final Map incomingFields) throws StateMachineException, ContextException { boolean returnValue = false; // Do execution pre work - executePre(executionID, incomingFields); + executePre(executionId, incomingFields); try { diff --git a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java index 4f4d38a19..3ff061fa4 100644 --- a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java +++ b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java @@ -43,6 +43,10 @@ import org.slf4j.ext.XLoggerFactory; public class JythonTaskSelectExecutor extends TaskSelectExecutor { private static final XLogger LOGGER = XLoggerFactory.getXLogger(JythonTaskSelectExecutor.class); + // Recurring string constants + private static final String TSL_FAILED_PREFIX = + "execute: task selection logic failed to set a return value for state \""; + // The Jython interpreter private final PythonInterpreter interpreter = new PythonInterpreter(); private PyCode compiled = null; @@ -77,20 +81,20 @@ public class JythonTaskSelectExecutor extends TaskSelectExecutor { /** * Executes the executor for the task in a sequential manner. * - * @param executionID the execution ID for the current APEX policy execution + * @param executionId the execution ID for the current APEX policy execution * @param incomingEvent the incoming event * @return The outgoing event * @throws StateMachineException on an execution error * @throws ContextException on context errors */ @Override - public AxArtifactKey execute(final long executionID, final EnEvent incomingEvent) + public AxArtifactKey execute(final long executionId, final EnEvent incomingEvent) throws StateMachineException, ContextException { boolean returnValue = false; // Do execution pre work - executePre(executionID, incomingEvent); + executePre(executionId, incomingEvent); try { // Check and execute the Jython logic @@ -103,10 +107,10 @@ public class JythonTaskSelectExecutor extends TaskSelectExecutor { try { final Object ret = interpreter.get("returnValue", java.lang.Boolean.class); if (ret == null) { - LOGGER.error("execute: task selection logic failed to set a return value for state \"" + LOGGER.error(TSL_FAILED_PREFIX + getSubject().getKey().getId() + "\""); throw new StateMachineException( - "execute: task selection logic failed to set a return value for state \"" + TSL_FAILED_PREFIX + getSubject().getKey().getId() + "\""); } returnValue = (Boolean) ret; @@ -114,7 +118,7 @@ public class JythonTaskSelectExecutor extends TaskSelectExecutor { LOGGER.error("execute: task selection logic failed to set a correct return value for state \"" + getSubject().getKey().getId() + "\"", e); throw new StateMachineException( - "execute: task selection logic failed to set a return value for state \"" + TSL_FAILED_PREFIX + getSubject().getKey().getId() + "\"", e); } -- cgit 1.2.3-korg