AIOOBE when ApexPdpPolicyForwarder#forward 59/68559/3
authorAlexis de Talhouët <adetalhouet89@gmail.com>
Sun, 23 Sep 2018 04:27:17 +0000 (00:27 -0400)
committerAlexis de Talhouët <alexis.de_talhouet@bell.ca>
Mon, 24 Sep 2018 15:54:34 +0000 (15:54 +0000)
Change-Id: Iebc19d2e734ead405ac398a1011dcd42990b20b8
Issue-ID: POLICY-1147
Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/apex/pdp/ApexPdpPolicyForwarder.java

index f71c6ae..98f4d93 100644 (file)
@@ -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)