summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java11
1 files changed, 8 insertions, 3 deletions
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<String> 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<String> 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;
}