aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/apex/pdp/ApexPdpPolicyForwarder.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/apex/pdp/ApexPdpPolicyForwarder.java b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/apex/pdp/ApexPdpPolicyForwarder.java
index f71c6aee..98f4d939 100644
--- a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/apex/pdp/ApexPdpPolicyForwarder.java
+++ b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/apex/pdp/ApexPdpPolicyForwarder.java
@@ -66,11 +66,14 @@ public class ApexPdpPolicyForwarder implements PolicyForwarder {
*/
@Override
public void forward(final Collection<Policy> policies) throws PolicyForwardingException {
- if (policies.size() > 1) {
+ if (policies.isEmpty()) {
+ final String message = "No apex policy to be forwarded to an apex engine";
+ LOGGER.debug(message);
+ throw new PolicyForwardingException(message);
+ } else if (policies.size() > 1) {
final String message = "More than one apex policy cannot be forwarded to an apex engine";
LOGGER.debug(message);
throw new PolicyForwardingException(message);
-
} else {
final Policy policy = (Policy) policies.toArray()[0];
if (policy.getClass().isAssignableFrom(PolicyAsString.class)