From 820b0e8e62e3821875ed32c4ab0f0b3183050c8f Mon Sep 17 00:00:00 2001 From: "a.sreekumar" Date: Thu, 23 Jan 2020 13:35:07 +0000 Subject: Handling supported policy type during PdpGroup Update Change-Id: I62fbfeb80b81f4cc6dc0049bbd4ab9dcc5065773 Issue-ID: POLICY-2023 Signed-off-by: a.sreekumar --- .../java/org/onap/policy/models/pdp/concepts/PdpGroups.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'models-pdp/src') 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; } -- cgit 1.2.3-korg