aboutsummaryrefslogtreecommitdiffstats
path: root/models-tosca/src/main/java/org
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@est.tech>2020-02-21 14:06:57 +0000
committera.sreekumar <ajith.sreekumar@est.tech>2020-02-24 10:31:01 +0000
commit7f6e3f7b55a80fb18b92991f958b1d5d1499b1a0 (patch)
treeff2dee333b00c55b8ceb9b973d9316bb9aff685e /models-tosca/src/main/java/org
parent8edf8b6b1fbafc63fca87cfba152684cc019c5ef (diff)
Fix to avoid ConcurrentModificationException in policy-models
Change-Id: If911bdd4116b722e13e00199d05b1794de4e79c2 Issue-ID: POLICY-1402 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
Diffstat (limited to 'models-tosca/src/main/java/org')
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java6
1 files 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<JpaToscaEntityType<ToscaEntity>> ancestorEntitySet = (Set<JpaToscaEntityType<ToscaEntity>>) entityTypes
.getAll(parentEntityTypeKey.getName(), parentEntityTypeKey.getVersion());
-
+ Set<JpaToscaEntityType<ToscaEntity>> 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;
}
/**