summaryrefslogtreecommitdiffstats
path: root/plugins/forwarding-plugins
diff options
context:
space:
mode:
authorAlexis de Talhouët <adetalhouet89@gmail.com>2018-09-23 00:27:17 -0400
committerAlexis de Talhouët <alexis.de_talhouet@bell.ca>2018-09-24 15:54:34 +0000
commit56f8e8f80a6ce624a6ba0c1a62a39256dfc4641c (patch)
tree996e24c0dafae7b0ee8f2dcf3bbb6a572767ab37 /plugins/forwarding-plugins
parent6931309e2969dbf7be71777f048dcab4830d1c05 (diff)
AIOOBE when ApexPdpPolicyForwarder#forward
Change-Id: Iebc19d2e734ead405ac398a1011dcd42990b20b8 Issue-ID: POLICY-1147 Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
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)