Sequence throws NPE if task outcome is null 54/102654/1
authorJim Hahn <jrh3@att.com>
Sat, 29 Feb 2020 13:16:34 +0000 (08:16 -0500)
committerJim Hahn <jrh3@att.com>
Sat, 29 Feb 2020 13:16:34 +0000 (08:16 -0500)
If a task outcome is null, then sequence() throws an NPE.  Modified
it to treat a null outcome as a failure.

Issue-ID: POLICY-1625
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: I57b8be27f72c7cbf43e0b3b8816696ab1928f396

models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java

index 24c7ec8..0436044 100644 (file)
@@ -166,7 +166,7 @@ public abstract class OperationPartial implements Operation {
 
         return outcome -> {
 
-            if (outcome != null && isSuccess(outcome)) {
+            if (isSuccess(outcome)) {
                 logger.info("{}: preprocessor succeeded for {}", getFullName(), params.getRequestId());
                 return CompletableFuture.completedFuture(outcome);
             }
@@ -344,7 +344,7 @@ public abstract class OperationPartial implements Operation {
      * @return {@code true} if the outcome was successful
      */
     protected boolean isSuccess(OperationOutcome outcome) {
-        return (outcome.getResult() == PolicyResult.SUCCESS);
+        return (outcome != null && outcome.getResult() == PolicyResult.SUCCESS);
     }
 
     /**