aboutsummaryrefslogtreecommitdiffstats
path: root/models-pdp/src
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@est.tech>2020-01-23 13:35:07 +0000
committera.sreekumar <ajith.sreekumar@est.tech>2020-01-23 13:35:12 +0000
commit820b0e8e62e3821875ed32c4ab0f0b3183050c8f (patch)
tree2e59b229b4adc6e3cdcc4ea4cd0f8d2d598ac601 /models-pdp/src
parent2a7cbf33a8b53bb83d43bf1adca7e6a8658cb262 (diff)
Handling supported policy type during PdpGroup Update
Change-Id: I62fbfeb80b81f4cc6dc0049bbd4ab9dcc5065773 Issue-ID: POLICY-2023 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
Diffstat (limited to 'models-pdp/src')
-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;
}