diff options
author | Jim Hahn <jrh3@att.com> | 2021-08-27 15:24:06 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-08-27 16:08:00 -0400 |
commit | f4580fa8a931c84b36d59e2ef853d1fba3d5917e (patch) | |
tree | 0c6a047fadfa26898af614460ac8699f2aa4a4ab /plugins/plugins-executor/plugins-executor-java | |
parent | 9d8894092ced589c0bdc5b9e85ee1bf1c85d3e36 (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-executor/plugins-executor-java')
3 files changed, 12 insertions, 12 deletions
diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java index 922f64f2d..21afa2ec1 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java +++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 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. @@ -21,7 +22,6 @@ package org.onap.policy.apex.plugins.executor.java; -import java.lang.reflect.Method; import java.util.Map; import java.util.Properties; import org.onap.policy.apex.context.ContextException; @@ -80,14 +80,14 @@ public class JavaStateFinalizerExecutor extends StateFinalizerExecutor { executePre(executionId, executionProperties, incomingFields); // Check and execute the Java logic - boolean returnValue = false; + var returnValue = false; try { // Find and call the method with the signature "public boolean getStateOutput(final // StateFinalizerExecutionContext executor) throws ApexException" // to invoke the // task logic in the Java class - final Method method = stateFinalizerLogicObject.getClass().getDeclaredMethod("getStateOutput", - new Class[] {StateFinalizerExecutionContext.class}); + final var classes = new Class[] {StateFinalizerExecutionContext.class}; + final var method = stateFinalizerLogicObject.getClass().getDeclaredMethod("getStateOutput", classes); returnValue = (boolean) method.invoke(stateFinalizerLogicObject, getExecutionContext()); } catch (final Exception e) { LOGGER.error("execute: state finalizer logic failed to run for state finalizer \"" + getSubject().getId() diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java index 736249efd..da6533f17 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java +++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java @@ -3,6 +3,7 @@ * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. + * 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. @@ -22,7 +23,6 @@ package org.onap.policy.apex.plugins.executor.java; -import java.lang.reflect.Method; import java.util.Map; import java.util.Properties; import org.onap.policy.apex.context.ContextException; @@ -83,13 +83,13 @@ public class JavaTaskExecutor extends TaskExecutor { executePre(executionId, executionProperties, incomingFields); // Check and execute the Java logic - boolean returnValue = false; + var returnValue = false; try { // Find and call the method with the signature "public boolean getEvent(final TaskExecutionContext executor) // throws ApexException" to invoke the // task logic in the Java class - final Method method = - taskLogicObject.getClass().getDeclaredMethod("getEvent", new Class[] {TaskExecutionContext.class}); + final var classes = new Class[] {TaskExecutionContext.class}; + final var method = taskLogicObject.getClass().getDeclaredMethod("getEvent", classes); returnValue = (boolean) method.invoke(taskLogicObject, getExecutionContext()); } catch (final Exception e) { LOGGER.error("execute: task logic failed to run for task \"" + getSubject().getKey().getId() + "\""); diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java index ee830ca53..27207a57d 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java +++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 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. @@ -21,7 +22,6 @@ package org.onap.policy.apex.plugins.executor.java; -import java.lang.reflect.Method; import java.util.Properties; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.event.EnEvent; @@ -84,13 +84,13 @@ public class JavaTaskSelectExecutor extends TaskSelectExecutor { executePre(executionId, executionProperties, incomingEvent); // Check and execute the Java logic - boolean returnValue = false; + var returnValue = false; try { // Find and call the method with the signature "public boolean getTask(final TaskSelectionExecutionContext // executor)" to invoke the task selection // logic in the Java class - final Method method = taskSelectionLogicObject.getClass().getDeclaredMethod("getTask", - new Class[] {TaskSelectionExecutionContext.class}); + final var classes = new Class[] {TaskSelectionExecutionContext.class}; + final var method = taskSelectionLogicObject.getClass().getDeclaredMethod("getTask", classes); returnValue = (boolean) method.invoke(taskSelectionLogicObject, getExecutionContext()); } catch (final Exception e) { LOGGER.error( |