diff options
author | Jim Hahn <jrh3@att.com> | 2020-02-26 14:23:16 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-02-26 14:23:16 +0000 |
commit | d1a3d4f7fc8f754937f10e320389825316662b2d (patch) | |
tree | ad5d84906c59bb7f54ea9b4f685b07a2fdc31fa4 /plugins/plugins-executor | |
parent | e1735a6044b9a0b5ec8e3afede88744a7d57782a (diff) | |
parent | 35840d835f581c2d61de1c57fe9963e36eb15c9f (diff) |
Merge "Fix Java 11/Checkstyle/Sonar warnings"
Diffstat (limited to 'plugins/plugins-executor')
3 files changed, 12 insertions, 7 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 ce242bafb..7eaaa0415 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +57,7 @@ public class JavaStateFinalizerExecutor extends StateFinalizerExecutor { // Get the class for state finalizer execution try { // Create the state finalizer logic object from the byte code of the class - stateFinalizerLogicObject = Class.forName(getSubject().getLogic()).newInstance(); + stateFinalizerLogicObject = Class.forName(getSubject().getLogic()).getDeclaredConstructor().newInstance(); } catch (final Exception e) { LOGGER.error("instantiation error on Java class \"" + getSubject().getLogic() + "\"", e); throw new StateMachineException("instantiation error on Java class \"" + getSubject().getLogic() + "\"", e); @@ -87,7 +88,7 @@ public class JavaStateFinalizerExecutor extends StateFinalizerExecutor { // to invoke the // task logic in the Java class final Method method = stateFinalizerLogicObject.getClass().getDeclaredMethod("getStateOutput", - new Class[] { StateFinalizerExecutionContext.class }); + new Class[] {StateFinalizerExecutionContext.class}); 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 1ceeba3b1..61ab6778e 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +57,8 @@ public class JavaTaskExecutor extends TaskExecutor { // Get the class for task execution try { // Create the task logic object from the byte code of the class - taskLogicObject = Class.forName(getSubject().getTaskLogic().getLogic()).newInstance(); + taskLogicObject = + Class.forName(getSubject().getTaskLogic().getLogic()).getDeclaredConstructor().newInstance(); } catch (final Exception e) { LOGGER.error("instantiation error on Java class \"" + getSubject().getTaskLogic().getLogic() + "\"", e); throw new StateMachineException( @@ -86,8 +88,8 @@ public class JavaTaskExecutor extends TaskExecutor { // 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 Method method = + taskLogicObject.getClass().getDeclaredMethod("getEvent", new Class[] {TaskExecutionContext.class}); 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 17758b19e..244a80a3c 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,7 +58,8 @@ public class JavaTaskSelectExecutor extends TaskSelectExecutor { // Get the class for task selection try { // Create the task logic object from the byte code of the class - taskSelectionLogicObject = Class.forName(getSubject().getTaskSelectionLogic().getLogic()).newInstance(); + taskSelectionLogicObject = Class.forName(getSubject().getTaskSelectionLogic().getLogic()) + .getDeclaredConstructor().newInstance(); } catch (final Exception e) { LOGGER.error( "instantiation error on Java class \"" + getSubject().getTaskSelectionLogic().getLogic() + "\"", e); @@ -89,7 +91,7 @@ public class JavaTaskSelectExecutor extends TaskSelectExecutor { // executor)" to invoke the task selection // logic in the Java class final Method method = taskSelectionLogicObject.getClass().getDeclaredMethod("getTask", - new Class[] { TaskSelectionExecutionContext.class }); + new Class[] {TaskSelectionExecutionContext.class}); returnValue = (boolean) method.invoke(taskSelectionLogicObject, getExecutionContext()); } catch (final Exception e) { LOGGER.error( |