aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/forwarding-plugins
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-09-25 10:41:32 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-25 10:41:32 +0000
commit0ab20917baad2b4c8bcb49f7e9451cbde7f4c98c (patch)
tree1c9e5923c4e9d40e64849cd67ebc70a950a645f3 /plugins/forwarding-plugins
parentf9e461e0b54f80d9256677f75256da3b434bd2f6 (diff)
parent56f8e8f80a6ce624a6ba0c1a62a39256dfc4641c (diff)
Merge "AIOOBE when ApexPdpPolicyForwarder#forward"
Diffstat (limited to 'plugins/forwarding-plugins')
-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)