From: a.sreekumar Date: Thu, 23 Jan 2020 13:35:07 +0000 (+0000) Subject: Handling supported policy type during PdpGroup Update X-Git-Tag: 2.2.1~98 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F80%2F100680%2F1;p=policy%2Fmodels.git Handling supported policy type during PdpGroup Update Change-Id: I62fbfeb80b81f4cc6dc0049bbd4ab9dcc5065773 Issue-ID: POLICY-2023 Signed-off-by: a.sreekumar --- diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java index 269130b07..6729d7e88 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java @@ -85,9 +85,14 @@ public class PdpGroups { * @return the validation result */ public ValidationResult checkForDuplicateGroups(ValidationResult result) { - List names = groups.stream().map(PdpGroup::getName).collect(Collectors.toList()); - if (groups.size() != new HashSet<>(names).size()) { - result = new ObjectValidationResult(GROUPS_FIELD, names, ValidationStatus.INVALID, "duplicate group names"); + if (null == groups) { + result.setResult(ValidationStatus.INVALID, "is null"); + } else { + List names = groups.stream().map(PdpGroup::getName).collect(Collectors.toList()); + if (groups.size() != new HashSet<>(names).size()) { + result = + new ObjectValidationResult(GROUPS_FIELD, names, ValidationStatus.INVALID, "duplicate group names"); + } } return result; }