From 7f6e3f7b55a80fb18b92991f958b1d5d1499b1a0 Mon Sep 17 00:00:00 2001 From: "a.sreekumar" Date: Fri, 21 Feb 2020 14:06:57 +0000 Subject: [PATCH] Fix to avoid ConcurrentModificationException in policy-models Change-Id: If911bdd4116b722e13e00199d05b1794de4e79c2 Issue-ID: POLICY-1402 Signed-off-by: a.sreekumar --- .../main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java index 88591bd91..3f2ebe797 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java @@ -234,16 +234,16 @@ public final class ToscaUtils { @SuppressWarnings("unchecked") Set> ancestorEntitySet = (Set>) entityTypes .getAll(parentEntityTypeKey.getName(), parentEntityTypeKey.getVersion()); - + Set> ancestorEntitySetToReturn = new HashSet<>(ancestorEntitySet); if (ancestorEntitySet.isEmpty()) { result.addValidationMessage(new PfValidationMessage(entityType.getKey(), ToscaUtils.class, ValidationResult.INVALID, "parent " + parentEntityTypeKey.getId() + " of entity not found")); } else { for (JpaToscaEntityType filteredEntityType : ancestorEntitySet) { - ancestorEntitySet.addAll(getEntityTypeAncestors(entityTypes, filteredEntityType, result)); + ancestorEntitySetToReturn.addAll(getEntityTypeAncestors(entityTypes, filteredEntityType, result)); } } - return ancestorEntitySet; + return ancestorEntitySetToReturn; } /** -- 2.16.6